-
Feb 21st, 2012, 07:58 PM
#1
Mixing JavaConfig with dispatcherservlet xml
I have setup a bunch of beans using java config @Configuration and initialize them with the ContextLoaderListener. However, for reasons irrelevant to this question, I would like to use an xml style for the DispatcherServlet so that i have for instance a dispatch-servlet.xml in my WEB-INF folder. This doesn't seem to work. Can the two styles be mixed?
Last edited by digid; Feb 22nd, 2012 at 09:01 AM.
-
Feb 22nd, 2012, 12:54 AM
#2
There should be nothing preventing you from doing that. You have to either add the @Configuration classes to your xml or use component-scanning to detect them. They aren't automatically added, so you have to do some work.
-
Feb 24th, 2012, 06:58 PM
#3
Got it to work. But only after refactoring my packages and @ComponentScan annotations. For some reason if I did a scan on the base package using an includeFilter on @Service and excludeFilter on @Configuration it would still find all my other classes annotated classes(e.g. @Controller, @Repository etc. ) and would blow up. Not sure if this was really what was happening but I did get it to work by reorganizing the ComponentScan.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules