Skip to content

Spring gRPC Migration from Ecosystem Projects

Dave Syer edited this page Jun 2, 2026 · 2 revisions

From net.devh to Spring gRPC

  • Replace net.devh:grpc-client-spring-boot-starter with org.springframework.boot:spring-boot-starter-grpc-server (for server apps) and/or org.springframework.boot:spring-boot-starter-grpc-client (for client apps) in your Gradle or Maven build. Replace org.springframework.grpc:spring-grpc-test with org.springframework.boot:spring-boot-starter-grpc-client-test. You no longer need to import a separate BOM — dependency versions are managed by Spring Boot 4.1.0 itself.

  • Classes annotated @GrpcGlobalServerInterceptor should now be annotated @Component and @GlobalServerInterceptor instead. (Search and replace imports and annotations.) Classes annotated @GrpcGlobalClientInterceptor should now be annotated @Component and @GlobalClientInterceptor instead. (Search and replace imports and annotations.) Search and replace net.devh.boot.grpc.server.service.GrpcService with org.springframework.grpc.server.service.GrpcService.

  • Classes annotated @GrpcAdvice with methods annotated @GrpcExceptionHandler should now be annotated @Component and implement the GrpcExceptionHandler interface instead.

  • Search and replace net.devh.boot.grpc.server.security.interceptors.AuthenticatingServerInterceptor.SECURITY_CONTEXT_KEY with org.springframework.grpc.server.security.GrpcSecurity.SECURITY_CONTEXT_KEY.

  • You may need to implement an AuthenticationProcessInterceptor and annotate it with @GlobalServerInterceptor. See Declarative Security with Spring Security.

  • If you implement GrpcAuthenticationReader, you'll need to implement GrpcAuthenticationExtractor instead.

  • Replace @GrpcClient field injection with @Autowired. In net.devh you annotated stub fields directly:

    @GrpcClient("myservice")
    private MyServiceGrpc.MyServiceBlockingStub stub;

    In Spring gRPC, declare @ImportGrpcClients on your application class (or a @Configuration) and autowire normally:

    @SpringBootApplication
    @ImportGrpcClients(basePackageClasses = MyServiceGrpc.class)
    public class MyApplication { ... }
    @Autowired
    private MyServiceGrpc.MyServiceBlockingStub stub;
  • Replace @GrpcChannelConfigurer beans with GrpcChannelBuilderCustomizer beans. To target a specific channel by name, use GrpcChannelBuilderCustomizer.matching("channelName", builder -> ...).

  • For SSL/TLS client channels, replace net.devh's grpc.client.<name>.security.* properties with spring.grpc.client.channel.<name>.ssl.*. Specifically, negotiation-type=TLS combined with secure=false (meaning skip certificate validation) becomes ssl.enabled=true and bypass-certificate-validation=true. To use an SSL bundle, set ssl.bundle=<bundle-name>.

  • In tests that use an in-process server, annotate the test class with @AutoConfigureTestGrpcTransport (previously @AutoConfigureInProcessTransport). Autowire your stubs directly rather than using the @GrpcClient("inProcess") annotation or the grpc.server.inProcessName and grpc.client.inProcess.address properties. If your stubs are not already declared as beans, add a @TestConfiguration class that declares them (using an autowired GrpcChannelFactory if needed). Also add @ImportGrpcClients (on the test class or the @TestConfiguration) to register gRPC stubs as Spring beans — this is now required explicitly.

  • In your application properties, replace grpc.server.port with spring.grpc.server.port, grpc.server.host with spring.grpc.server.address, and grpc.client.<name>.address with spring.grpc.client.channel.<name>.target.

Clone this wiki locally