I'm migrating an app form spring mvc to spring webflux and I can't figure out what's the equivalent of this webMvc conf :
@Configuration
public class PathMatchingConfigurationAdapter implements WebMvcConfigurer {
@Override
public void configureContentNegotiation(ContentNegotiationConfigurer configurer) {
configurer.favorPathExtension(false);
}
}
any idea is welcome
both infrastructure will compete for the same job (for example, serving static resources, the mappings, etc) mixing both runtime models within the same container is not a good idea and is likely to perform badly or just not work at all.
Spring 5.0 has introduced WebFlux to support the reactive web in a non-blocking manner. WebFlux is based on the reactor API, just another awesome implementation of the reactive stream. Spring WebFlux supports reactive backpressure and Servlet 3.1+ with its non-blocking I/O.
Spring 5 includes Spring WebFlux, which provides reactive programming support for web applications. In this tutorial, we'll create a small reactive REST application using the reactive web components RestController and WebClient. We'll also look at how to secure our reactive endpoints using Spring Security.
Spring WebFlux is a web framework that's built on top of Project Reactor, to give you asynchronous I/O, and allow your application to perform better. If you're familiar with Spring MVC and building REST APIs, you'll enjoy Spring WebFlux.
Spring WebFlux does not support suffix pattern matching, see SPR-15639 for more information on the rationale behind that decision.
As a replacement, you can use a ParameterContentTypeResolver
which does the same thing but with a query parameter like format=json
. You can configure this with:
@Configuration
public class WebFluxConfig implements WebFluxConfigurer {
public void configureContentTypeResolver(RequestedContentTypeResolverBuilder builder) {
builder.parameterResolver().headerResolver();
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With