Description
I would like to configure the server builder from different aspects of the application. For example, I might have a conditional configuration that changes the executor and another conditional configuration that adds an interceptor. It is easier to create multiple, focused configurers rather than create a single configurer where I need to do all the above.
Unless I'm missing something, I'm only allowed to define a single GRpcServerBuilderConfigurer
@Bean
in my application - it throws an ambiguous bean definition otherwise.
I can obviously work around the issue by creating my own "customizer". I can inject a list of "customizers" to the configurer bean definition and pass the builder to all of them, e.g.
interface ServerBuilderCustomizer {
void customize(ServerBuilder<?> serverBuilder)
}
@Bean
public GRpcServerBuilderConfigurer example(List<ServerBuilderCustomizer> customizers) {
return new GRpcServerBuilderConfigurer() {
public void configure(ServerBuilder<?> serverBuilder) {
customizers.forEach(customizer -> customizer.customize(serverBuilder));
}
};
}
However, it would be easier if the library accepted a list of configurers in the first place. Let me know if you have any thoughts.