dev-tool : sts
spring - version 3.2.x
when i use spring-mobile-device then
error ocured fallowing
"Could not instantiate bean class [org.springframework.mobile.device.Device]: Specified class is an interface] with root cause"
i try to solved this problem ,
example : https://spring.io/guides/gs/device-detection/
but
same error occoured..
.. search and more .. google...
1. pom.xml <-- inject to dependency
<dependency>
<groupId>org.springframework.mobile</groupId>
<artifactId>spring-mobile-device</artifactId>
<version>1.1.3.RELEASE</version>
</dependency>
2. web.xml <--add filter config
<!--device filter_start() -->
<filter>
<filter-name>deviceResolverRequestFilter</filter-name>
<filter-class>org.springframework.mobile.device.DeviceResolverRequestFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>deviceResolverRequestFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<!--device filter_end() -->
3. using like this ... (controller)
if( DeviceUtils.getCurrentDevice(request).isMobile() || DeviceUtils.getCurrentDevice(request).isTablet() ){
model.addAttribute("is_mobile", true);
}else{
model.addAttribute("is_mobile", false);
}
- Posted
- Filed under JSP, JAVA