I am developing a set of reusable stuff like filters, global exception handlers and other spring webflux components, that would be used by reactive spring apps (webflux)
Since, this is a library (a jar), that will be consumed by apps, I dont want to annotate the global exception handler class with @Configuration and instead would like to let the applications programmatically configure the exception handler as needed. I see from the docs, that the way to configure the WebExceptionHandler is through the HttpHandler as a bean definition for a spring boot application.
```@Configuration public class TestApplicationConfig {
@Bean
public HttpHandler routeHandler(ApplicationContext applicationContext) {
return WebHttpHandlerBuilder.applicationContext(applicationContext)
.filter(new TenantContextFilter(),
.exceptionHandler(new ServiceExceptionHandler())
.build();
}
}
```//exception handler
@Order(-2)
public class ServiceExceptionHandler implements ErrorWebExceptionHandler {
@SuppressWarnings("NullableProblems")
@Override
public Mono<Void> handle(ServerWebExchange serverWebExchange, Throwable err) {
}
}
Please note that the filter gets called eventhough I removed @Component annotation from it, so that it doesnt get discovered through auto-configuration. So, the HttpHandler configuration works, but just the exception handler is not kicking in.
Comment From: bclozel
Hello @praburajan could you create a small project that reproduces the issue? The bug or configuration mistake might be in a place that's not obvious from your code snippets. A small project that I can clone/download (something created with start.spring.io) would definitely help.
Thanks!
Comment From: spring-projects-issues
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.
Comment From: spring-projects-issues
Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.