Skip to content

Failed autowired *BlockingV2Stub type generated by gRPC-java 1.70.0 #1177

Open
@seal90

Description

@seal90

The context

The flow autowired will fail, and the main configuration. The new *BlockingV2Stub from grpc/grpc-java@ea8c31c commit.

    @GrpcClient("hello")
    private HelloWorldGrpc.HelloWorldBlockingV2Stub helloWorldBlockingV2Stub;
    <grpc.version>1.70.0</grpc.version>
    <protobuf.version>3.25.5</protobuf.version>
// User Code definitions
service HelloWorld {
  // Sends a greeting
  rpc SayHello (HelloRequest) returns (HelloReply) {}

  rpc ToSayHello (HelloRequest) returns (stream HelloReply) {}
}

// The request message containing the user's name.
message HelloRequest {
  string name = 1;
}

// The response message containing the greetings
message HelloReply {
  string message = 1;
}

Both HelloWorldBlockingV2Stub and HelloWorldBlockingStub extends AbstractBlockingStub so BlockingStubFactory cann't work well. FallbackStubFactory can work.

public static final class HelloWorldBlockingV2Stub
      extends io.grpc.stub.AbstractBlockingStub<HelloWorldBlockingV2Stub>{...}

public static final class HelloWorldBlockingStub
    extends io.grpc.stub.AbstractBlockingStub<HelloWorldBlockingStub> {...}
public class BlockingStubFactory extends StandardJavaGrpcStubFactory {

    @Override
    public boolean isApplicable(Class<? extends AbstractStub<?>> stubType) {
        return AbstractBlockingStub.class.isAssignableFrom(stubType);
    }

    @Override
    protected String getFactoryMethodName() {
        return "newBlockingStub";
    }
}

The bug

What's the problem? What's not working? What do you expect to happen.

Stacktrace and logs

Is there a stacktrace or a hint in the logs? (very important)
Screenshots work as well, but don't screenshot your logs.

Steps to Reproduce

Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

The application's environment

Which versions do you use?

  • Spring (boot):
  • grpc-java:
  • grpc-spring-boot-starter:
  • java: version + architecture (64bit?)
  • Other relevant libraries...

Additional context

  • Did it ever work before?
  • Do you have a demo?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething does not work as expected

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions