Spring mobile documentation suggests adding the following configuration:
<mvc:annotation-driven> <mvc:argument-resolvers> <beans:bean class="org.springframework.mobile.device.DeviceWebArgumentResolver" /> </mvc:argument-resolvers> </mvc:annotation-driven>
pass the current Device object as an argument to @Controller methods.
However, you can use:
@EnableWebMvc @Configuration public class WebConfig extends WebMvcConfigurerAdapter { }
and bypass the <mvc:annotation-driven> configuration.
Then how to programmatically add DeviceWebArgumentResolver ?
Solution (Luciano):
@EnableWebMvc @Configuration public class WebConfig extends WebMvcConfigurerAdapter { @Override public void addArgumentResolvers( List<HandlerMethodArgumentResolver> argumentResolvers) {
JΓ©rΓ΄me verstrynge
source share