java - Problem using Spring 3 MVC -


i have jars in spring 3 framework on classpath , wanted add spring 3 mvc app config. originally, had following xml.

<?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:util="http://www.springframework.org/schema/util"        xmlns:context="http://www.springframework.org/schema/context"        xsi:schemalocation="         http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd         http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd         http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd       <context:annotation-config/>     <bean class="com.apppackage.app.config.appcontextconfig" />      <!-- autoscan @controller type controllers -->     <context:component-scan base-package="com.apppackage.app.controller" />  

that snippet of relevant information. app worked fine above xml, added spring 3 mvc in config following changes:

<?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:util="http://www.springframework.org/schema/util"        xmlns:mvc="http://www.springframework.org/schema/mvc"        xmlns:context="http://www.springframework.org/schema/context"        xsi:schemalocation="         http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd         http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd         http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd         http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd">      <context:annotation-config/>      <mvc:annotation-driven />     <bean class="com.apppackage.app.config.appcontextconfig" />      <!-- autoscan @controller type controllers -->     <context:component-scan base-package="com.apppackage.app.controller" /> 

now, have problems on application. spring not seem autowiring beans before. getting following error on controllers:

no adapter handler [com.apppackage.app.controller.login.logincontroller@274b9691]: handler implement supported interface controller? 

when add <mvc:annotation-driven /> context, you're disabling support old-style controller type hierarchy.

the error messages suggests me logincontroller not annotated controller, subtype of controller interface.

if don't want refactor logincontroller, remove <mvc:annotation-driven /> context. unless you're using jsr-303 validation or json serialization, don't need anyway


Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

aspxgridview - Devexpress grid - header filter does not work if column is initially hidden -

c# - How to execute a particular part of code asynchronously in a class -