grpc-ecosystem / grpc-spring

Spring Boot starter module for gRPC framework.
https://grpc-ecosystem.github.io/grpc-spring/
Apache License 2.0
3.48k stars 812 forks source link

请问一下server端方法参数中的request的字段为什么都是带有下划线的,有没有办法直接转化为我的实体类? #948

Closed wuaoya closed 1 year ago

wuaoya commented 1 year ago

`@GrpcService public class GrpcServerService extends SimpleGrpc.SimpleImplBase {

@Override
public void sayHello(final HelloRequest req, final StreamObserver<HelloReply> responseObserver) {
    final HelloReply reply = HelloReply.newBuilder().setMessage("Hello ==> " + _**### req.getName())**_.build();
    responseObserver.onNext(reply);
    responseObserver.onCompleted();
}

}`

请看这块代码,req.getName()只有get方法才能取到值,但是我字段太多了想通过fastJson之类的方法直接将参数转化为我的业务实体从而便于操作,有没有方法?

yidongnan commented 1 year ago

There is nothing we can do there. Please ask this question in the fastjson repo and link it here.