I have the following in my web.xml:
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:applicationContext-*.xml</param-value>
</context-param>
I have 2 files:
- applicationContext-web.xml in the WEB-INF next to the web.xml
- applicationContext-service.xml in the myapp-service.jar
When deploying the app, I get a
No matching bean of type [AServiceBean] found for dependency: expected
at least 1 bean which qualifies as autowire candidate for this
dependency.
Seems like the applicationContext-service.xml is not found. If I copy it next to the web.xml, it works fine. I can’t figure out why this happens.
The server is a Tomcat 6.
Any help is appreciated.
Thanks.
EDIT
For clarification: if I use
<param-value>
classpath:applicationContext-web.xml,
classpath:applicationContext-service.xml
</param-value>
the app deploys without any issue, so it’s just a matter of finding (or not finding) the applicationContext-service.xml
You need to place your config files into the classpath.
or sth similar to this to keep them in one place
applicationContext-service.xml : You dont need to copy this one if it is already in the jar file
Sample main-config.xml