I have a main webapp project that uses multiple web-fragments. It runs on Tomcat 8.
Here in my web.xml file, I have a reference to main Spring context like:
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
classpath*:META-INF/spring/mainCtx.xml
</param-value>
</context-param>
And in WEB-INF/lib
folder I have a componentA.jar
that contains a web-fragment.xml under its own META-INF
folder (different from the main app's META-INF
folder):
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
classpath*:META-INF/spring/componentA_Ctx.xml
</param-value>
</context-param>
However, it seems that Spring cannot find my compomentA_Ctx.xml inside the jar. Upon reading further, it seems that because there is a name clash contextConfigLocation
in 2 context files.
My goal is to give compoment A plugability so that it is independent from the main webapp. Hence I want to load its context seprately.
Is there anyway to make Spring look for contexts in both locations? Or a way to define contexts separately in web.xml and web-fragment.xml?