You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: spring-grpc-docs/src/main/antora/modules/ROOT/pages/server.adoc
+32-1Lines changed: 32 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,6 +12,37 @@ There are some `BindableServices` available off the shelf that you could include
12
12
Very commonly, you will create your own `BindableService` by extending the generated service implementation from your Protobuf file.
13
13
The easiest way to activate it is to simply add a Spring `@Service` annotation to the implementation class and have it picked up by the `@ComponentScan` in your Spring Boot application.
14
14
15
+
[[service-filtering]]
16
+
=== Service Filtering
17
+
All available `BindableService` beans are bound to all running gRPC servers.
18
+
However, you can register a `ServerServiceDefinitionFilter` bean to decide which services are bound to which server factories.
19
+
20
+
The following example prevents the `my-unwanted-service` service from being applied to any servers created by the server factory that the filter is applied to.
The `InProcessGrpcServerFactory` picks up the `ServerServiceDefinitionFilter` automatically.
32
+
Any other server factory will require you to provide a `GrpcServerFactoryCustomizer` in which you can modify the factory by adding a filter, as shown in the following example:
All global interceptors are applied to all created services by default.
125
156
However, you can register a `ServerInterceptorFilter` bean to decide which interceptors are applied to which server factories.
126
157
127
-
The following example prevents the `ExtraThingsInterceptor` interceptor from being applied to any servers created by the `InProcessGrpcServerFactory` server factory.
158
+
The following example prevents the `ExtraThingsInterceptor` interceptor from being applied to any servers created by the server factory that the filter is applied to.
Copy file name to clipboardExpand all lines: spring-grpc-spring-boot-autoconfigure/src/main/java/org/springframework/grpc/autoconfigure/server/GrpcServerFactoryConfigurations.java
0 commit comments