grpc-spring
grpc-spring copied to clipboard
The gRPC server does not start, Java
Labeled the class with the annotation @GrpcServer
@GrpcService
public class UserService extends UserGrpc.UserImplBase {...code}
I'm using it together with spring boot web.
Gradle dependencies:
dependencies {
implementation 'net.devh:grpc-server-spring-boot-starter:2.14.0.RELEASE'
implementation 'net.devh:grpc-server-spring-boot-autoconfigure:2.14.0.RELEASE'
implementation 'org.springframework.boot:spring-boot-starter-data-jdbc'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.postgresql:postgresql:42.6.0'
implementation 'javax.annotation:javax.annotation-api:1.3.2'
implementation 'org.flywaydb:flyway-core'
implementation 'org.springframework.cloud:spring-cloud-starter-netflix-eureka-client'
compileOnly 'org.projectlombok:lombok'
runtimeOnly 'org.postgresql:postgresql'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'io.grpc:grpc-testing:1.57.2'
}
There is nothing about gRPC in the startup logs, no error or useful information, not even in DEBUG level
Perhaps something else is needed besides the @GrpcService annotation and extension?
Nothing more. The question is which version of Spring Boot do you use?
Was using the latest version of Spring boot Then I decided to roll back to 2.6.13 Everything worked, apparently there is no support for newer versions of Spring.
Actually it is. You have to add @ImportAutoConfiguration(GrpcClientAutoConfiguration.class) to your configuration. Current version of the starter do not have autoconfiguration file in format supported from 2.7, and old one is not supported since 3.0.
@Aberkingaliev see https://github.com/yidongnan/grpc-spring-boot-starter/issues/778#issuecomment-1569362944 , full context: https://github.com/yidongnan/grpc-spring-boot-starter/issues/953