I have a project written using the inheritance & XML config method for controllers:
then in my app-servlet.xml I configure the controller with some security interceptors:Code:public class MyController extends SimpleFormController...
This all works perfectly. I am still building this app for the client, however, and I've started to use Spring's new annotation driven controller system plus @Resource/Autowiring + @RequestMapping, @ModelAttribute, etc so I don't need any XML config.Code:<bean id="myController" class="org.springframework.aop.framework.ProxyFactoryBean"> <property name="target"> <ref local="myControllerTarget" /> </property> <property name="interceptorNames"> <list> <value>LoginAdvisor</value> <value>AdminAdvisor</value> </list> </property> </bean> <bean id="myControllerTarget" class="com.app.ui.controllers.MyController" /> <bean class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping" id="urlMapping"> <prop key="/somePage.html">myController</prop>
I got the two methods to work well together except for those security interceptors. I've been pulling my hair out on this one for a while.. At first I was looking for a way to apply the LoginAdvisor, AdminAdvisor, etc. via some nice annotation on the Controller, but at this point I'd settle for anything.
When I try to take my new-style controllers (using @Controller, @RequestMapping) and make a <bean> entry for them + urlMapping entry + wrap them like before, it simply won't resolve. I even tried taking out the @Controller but it won't work because I think the @RequestMapping and the manual urlMapping entry are conflicting.


Reply With Quote