Add more detail about disabling the servlet

This commit is contained in:
Dave Syer
2025-04-03 13:22:04 +01:00
parent a3d7ba643d
commit d93ad2b865
2 changed files with 6 additions and 1 deletions

View File

@@ -87,6 +87,11 @@ Clients can connect to the server using that path, which is what any gRPC client
The gRPC server has fewer configuration options when running in a servlet container, as the servlet container is responsible for the network layer.
You can still add `ServerBuilderCustomizer` beans to customize the server as it is built, but some features common in the "native" builders are not available and may throw exceptions at runtime.
== Native gRPC Server inside a Servlet Container
The native gRPC server (with netty etc.) will run happily inside a web application, listening on a different port.
If you want to do that in any Spring Boot application, it should be sufficient *not* to include the `grpc-servlet-jakarta` dependency on your classpath.
This dependency is only provided by the `spring-grpc-server-web-spring-boot-starter` (or if you include it explicitly yourself), but if you need to be explicit you can set `spring.grpc.server.servlet.enabled=false` in your application configuration.
[[server-interceptor]]
== Server Interceptors

View File

@@ -32,7 +32,7 @@
{
"name": "spring.grpc.server.servlet.enabled",
"type": "java.lang.Boolean",
"description": "Whether to use a servlet server in a servlet-based web application. When the value is false, a native gRPC server will be forced.",
"description": "Whether to use a servlet server in a servlet-based web application. When the value is false, a native gRPC server will be created as long as one is available, and it will listen on its own port. Should only be needed if the GrpcServlet is on the classpath",
"defaultValue": true
},
{