dubbo Java-Client 调用 Go-Server 接口时,获取的对象一直为null
777888tp opened this issue · 1 comments
777888tp commented
hessian 文档显示默认会将go struct 字段名称转换为小驼峰式 但是使用时发现并不行
type User struct {
ID string
Name string
Age int32
}
func (u *User) JavaClassName() string {
return "org.apache.dubbo.User"
}
type UserProvider struct {
}
func (u *UserProvider) GetUser(ctx context.Context, req int32) (*User, error) {
var err error
logger.Infof("req:%#v", req)
user := &User{}
user.ID = strconv.Itoa(int(req))
user.Age=40
return user, err
}
func (s *UserProvider) MethodMapper() map[string]string {
return map[string]string{
"GetUser": "getUser",
}
}
func init(){
config.SetProviderService(&UserProvider{})
hessian.RegisterPOJO(&User{})
}
func main() {
if err := config.Load(); err != nil {
panic(err)
}
select {}
}
777888tp commented
需要使用自定义标签 hessian:"id"