My original problem was how to configure Spring to use the
<context:load-time-weaver/>
directive when using Tomcat and not to use it when running in say WebSphere or Jetty or WebLogic.
Here is the best solution I found. Please comment
1. Create two spring configurations.
projectname-config-weaver.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/mvc"
</beans:beans>
projectname-config.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/mvc"
Note: NO PROFILE, so this is active on all servers
In my case the web.xml has
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/application-security.xml, /WEB-INF/projectname-config.xml, /WEB-INF/projectname-config-weaver.xml</param-value>
</context-param>
In the tomcat VM args I add
-Dspring.profiles.active=tomcat