Skip to content

Commit 58f2e52

Browse files
committed
Update docs and cosmetics
1 parent ac3ecb5 commit 58f2e52

File tree

3 files changed

+21
-2
lines changed

3 files changed

+21
-2
lines changed

spring-grpc-docs/src/main/antora/modules/ROOT/pages/server.adoc

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,23 @@ The following example prevents the `ExtraThingsInterceptor` interceptor from bei
130130
----
131131
@Bean
132132
ServerInterceptorFilter myInterceptorFilter() {
133-
return (interceptor, service, serverFactory) ->
134-
!(interceptor instanceof ExtraThingsInterceptor && serverFactory instanceof InProcessGrpcServerFactory);
133+
return (interceptor, service) ->
134+
!(interceptor instanceof ExtraThingsInterceptor);
135+
}
136+
----
137+
138+
An `InProcessGrpcServerFactory` picks up the `ServerInterceptorFilter` automatically.
139+
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:
140+
141+
[source,java]
142+
----
143+
@Bean
144+
GrpcServerFactoryCustomizer myServerFactoryCustomizer() {
145+
return factory -> {
146+
if (factory instanceof NettyGrpcServerFactory) {
147+
((DefaultGrpcServerFactory)factory).setInterceptorFilter(myInterceptorFilter());
148+
}
149+
};
135150
}
136151
----
137152

spring-grpc-docs/src/main/antora/modules/ROOT/pages/whats-new.adoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ This section covers the changes made from version 0.8.0 to version 0.9.0.
1010
* Upgrade to Spring Boot 3.5.0.
1111
* `StubFactory` contract changes: the "supports" method is now a static method (it is called before an instance is created).
1212
* Removed `GrpcClientFactoryCustomizer` in favour of `GrpcChannelBuilderCustomizer`.
13+
* Added ability to filter interceptors in in-process gRPC clients.
14+
* Added ability to filter global interceptors and service definitions - easy to do for `InProcessGrpcServer` and possible to do for `NettyGrpcServer` by registering a customizer.
1315

1416
[[what-s-new-in-0-6-0-since-0-5-0]]
1517
== What's New in 0.6.0 Since 0.5.0

spring-grpc-spring-boot-autoconfigure/src/main/java/org/springframework/grpc/autoconfigure/client/ClientInterceptorsConfiguration.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,15 @@
1818
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
1919
import org.springframework.context.ApplicationContext;
2020
import org.springframework.context.annotation.Bean;
21+
import org.springframework.context.annotation.Configuration;
2122
import org.springframework.grpc.client.ClientInterceptorsConfigurer;
2223

2324
/**
2425
* Configuration for {@link ClientInterceptorsConfigurer}.
2526
*
2627
* @author Chris Bono
2728
*/
29+
@Configuration(proxyBeanMethods = false)
2830
public class ClientInterceptorsConfiguration {
2931

3032
@Bean

0 commit comments

Comments
 (0)