I would like to use argument-resolvers
in Spring boot. How do I go about it?
It is done in XML as below.
<mvc:annotation-driven>
<mvc:argument-resolvers>
<bean class="nl.t42.spring31.ValidatingRequestBodyMethodArgumentResolver"/>
</mvc:argument-resolvers>
</mvc:annotation-driven>
See here
You can do:
@Configuration
@EnableWebMvc
public class WebConfig extends WebMvcConfigurerAdapter {
@Override
public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
// equivalent to <mvc:argument-resolvers>
}
@Override
public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
// equivalent to <mvc:message-converters>
}
}
@EnableWebMvc
will override the Boot defaults, you may want to skip it.
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