While the wildcard solution is quicker and more flexible, I would suggest that you explicitly indentify the contexts that you require. First create a context specific to your web application.
Code:
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext-[myapplication]*.xml</param-value>
</context-param>
This applicationContext-[myapplication]*.xml file would then import the specific context files that the application expects.
Code:
<beans>
<import resource="/applicationContextA.xml"/>
<import resource="/applicationContextB.xml"/>
<import resource="/applicationContextC.xml"/>
</beans>
In this example, i would expect jar 1 and jar 2 to have different internal package structures. In the case where the spring context files are packages along side the java source, this whould allow the same sping context file name to be used in two different jars, and still be uniquely identified.
Code:
<beans>
<import resource="/com/project/sub-project-1/applicationContextA.xml"/>
<import resource="/com/project/sub-project-2/applicationContextA.xml"/>
</beans>
Does anybody have a link to recommended or best practice guidelines for naming and packaging spring context files?