Add GlobalServerInterceptor to service discovery

This commit builds upon the previously added service discoverer
by adding support for finding all server interceptor beans that
are marked w/ the newly added `@GlobalServerInterceptor`
annotation.

Resolves #4

Signed-off-by: Chris Bono <chris.bono@gmail.com>
This commit is contained in:
Chris Bono
2024-11-06 11:15:28 -06:00
committed by Dave Syer
parent daf8e046c3
commit 4daf41392a
5 changed files with 255 additions and 9 deletions

View File

@@ -85,4 +85,24 @@ dependencies {
The `spring.grpc.server.*` properties will be ignored in facour of the regular `server.*` properties in this case.
The servlet that is created is mapped to process HTTP POST requests to the paths defined by the registered services, as `/<service-name>/*`.
Clients can connect to the server using that path, which is what any gRPC client library will do.
Clients can connect to the server using that path, which is what any gRPC client library will do.
[[server-interceptor]]
== Server Interceptors
=== Global
To add a server interceptor to be applied to all services you can simply register a server interceptor bean and then annotate it with `@GlobalServerInterceptor`.
The interceptors are ordered according to their bean natural ordering (i.e. `@Order`).
[source,java]
----
@Bean
@Order(100)
@GlobalServerInterceptor
ServerInterceptor myGlobalLoggingInterceptor() {
return new MyLoggingInterceptor();
}
----
=== Per-Service
This is a **WIP** and will be available soon.