Nigel W
May 13th, 2011, 12:19 PM
Hi,
I am trying to use "spring mobile" but I am having little success so far.
I have made the following changes to my exisiting Spring 3.0 MVC project.
POM - move
spring-orm
spring-context
spring-beans
spring-core
spring-webmvc
spring-web
spring-jdbc
spring-context-support
org.springframework dependancies to 3.1.0.M1.
change:
<?xml version="1.0" encoding="UTF-8" ?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd">
<!-- Configures the @Controller programming model
-->
<mvc:annotation-driven />
</beans>
to
<?xml version="1.0" encoding="UTF-8" ?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:device="http://www.springframework.org/schema/mobile/device"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd http://www.springframework.org/schema/mobile/device http://www.springframework.org/schema/mobile/device/spring-mobile-device-1.0.xsd">
<!-- When went to Spring 3.1 change line above to 3.1 -->
<!-- Configures the @Controller programming model -->
<mvc:annotation-driven>
<mvc:argument-resolvers>
<bean class="org.springframework.mobile.device.DeviceWebArgumen tResolver" />
</mvc:argument-resolvers>
</mvc:annotation-driven>
<mvc:interceptors>
<!-- On pre-handle, resolve the device that originated the web request -->
<bean class="org.springframework.mobile.device.DeviceResolverHa ndlerInterceptor" />
</mvc:interceptors>
</beans>
In my controller I am trying to bind 'Device'
public String showUserPage(Principal principal,
@RequestParam(value="userid") Long userid,
ModelMap model,
Device device){
but I am getting the following exception.
org.springframework.beans.BeanInstantiationExcepti on: Could not instantiate bean class [org.springframework.mobile.device.Device]: Specified class is an interface
Any help greatly appreciated.
I am trying to use "spring mobile" but I am having little success so far.
I have made the following changes to my exisiting Spring 3.0 MVC project.
POM - move
spring-orm
spring-context
spring-beans
spring-core
spring-webmvc
spring-web
spring-jdbc
spring-context-support
org.springframework dependancies to 3.1.0.M1.
change:
<?xml version="1.0" encoding="UTF-8" ?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd">
<!-- Configures the @Controller programming model
-->
<mvc:annotation-driven />
</beans>
to
<?xml version="1.0" encoding="UTF-8" ?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:device="http://www.springframework.org/schema/mobile/device"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd http://www.springframework.org/schema/mobile/device http://www.springframework.org/schema/mobile/device/spring-mobile-device-1.0.xsd">
<!-- When went to Spring 3.1 change line above to 3.1 -->
<!-- Configures the @Controller programming model -->
<mvc:annotation-driven>
<mvc:argument-resolvers>
<bean class="org.springframework.mobile.device.DeviceWebArgumen tResolver" />
</mvc:argument-resolvers>
</mvc:annotation-driven>
<mvc:interceptors>
<!-- On pre-handle, resolve the device that originated the web request -->
<bean class="org.springframework.mobile.device.DeviceResolverHa ndlerInterceptor" />
</mvc:interceptors>
</beans>
In my controller I am trying to bind 'Device'
public String showUserPage(Principal principal,
@RequestParam(value="userid") Long userid,
ModelMap model,
Device device){
but I am getting the following exception.
org.springframework.beans.BeanInstantiationExcepti on: Could not instantiate bean class [org.springframework.mobile.device.Device]: Specified class is an interface
Any help greatly appreciated.