You can change configuration file names for WAR and JAR - my-war-beans.xml & my-jar-beans.xml. Then define ContextLoaderListener so that it uses my-war-beans.xml (idea is to provide only one file as configuration entry point):
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath*:my-war-beans.xml</param-value>
</context-param>
And then just import beans from my-jar-beans.xml in my-war-beans.xml:
<beans>
<!-- Include beans from JAR -->
<import resource="classpath*:my-jar-beans.xml"/>
<!-- List beans from WAR -->
<bean id="myBean" class="myclass" />
</beans>
Make sure that your bean definition files have unique names. Classpath is flat so if names are same - this approach will be vulnerable to jar hell problems. Note that you may need to change URLs like "classpath*:my-jar-beans.xml" to something else, depends on where you store files inside a JAR/WAR.