I've been working on a project where controllers have been written extending Controller classes. Could I configure and use the POJO based Controllers as well (using @Controller) in the same application?
Many thanks
I've been working on a project where controllers have been written extending Controller classes. Could I configure and use the POJO based Controllers as well (using @Controller) in the same application?
Many thanks
Thanks jamestastic and skaffman, its working all fine now :)
Below are the lines needed to to be addeded to the web configuration file to have them working together:
I was too lazy to not to add line 8 in my main application.
Many thanks
Yes you can. You'll need to include the Spring JavaConfig project library, as annotation configuration was not part of the 2.5 core.
Here is an example I wrote a while back comparing Google Guice with Spring. Toward the bottom (look for @ImportXml), I show how you can combine Spring XML configuration with annotation configuration. The configuration looks like this:
See the Spring Reference regarding combining XML and Annotation configuration. This is from the documentation for Spring 3, but it should still apply (with perhaps minor changes in class names and paths from the old Spring JavaConfig project).
Absolutely. You can mix them together as much as you choose.
DispatcherServlet
should recognise both old-style and new-style controllers together in the same app.In Spring >= 3.0 use @ImportResource annotation