Closed jetaggart closed 1 year ago
After asking this I realized I could just convert it to a BindableService
:
@Bean
@Singleton
fun greeterEndpoint(): BindableService {
return BindableService {
ServerInterceptors.intercept(GreetingEndpoint(), TestInterceptor())
}
}
I still wonder if there a more ergonomic way to do this?
If you have improvement ideas contributions are welcome
I'm not sure I'm experienced enough to contribute code but looking at the source, could you just add ServerServiceDefinition
to the list of injected params here:
Then iterate and add the services here:
?
Feature description
I'd like to have interceptors on a per service basis, for example if I'm using raw
grpc-kotlin
I can configure my server like this:Is this possible? If not, how could it be added?
I attempted this:
But get this compiler exception:
It appears the
GrpcServiceBuilder
class only expectsBindableService
and notServerServiceDefinition
which is the return type of.intercept
. Should the builder look for injectedServerServiceDefinition
as well and treat those as services?https://grpc.github.io/grpc-java/javadoc/io/grpc/ServerBuilder.html