Spring Loaded: Integration with Spring MVC maven project Spring Loaded: Integration with Spring MVC maven project spring spring

Spring Loaded: Integration with Spring MVC maven project


I was trying SpringLoaded for a quick demonstration using Petclinic on top of Aptache Tomcat 7 during this week facing same issue as discussed here. Finally I found that I need to add the project to the Tomcat classpath. So in my case, I have opened the Tomcat "launch configuration" in Eclipse, and in the classpath tab, I have added my project in the "user entries" group. This causes springloaded works fine.


You DO need "Automatic Publishing" in Tomcat, because the changed .class files are not copied to the temporary folder where Tomcat has the application deployed to.

For example, in my local instance, the temporary Tomcat deployment folder is [WORKSPACE_FOLDER]\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps. In this folder I have my Eclipse web app resources (classes and other files) copied over and this is where Tomcat is picking them up for deployment.While my Eclipse web app has its .class files compiled in [WORKSPACE_FOLDER]\[MY_WEB_APP_FOLDER]\target when I change one class source code, the class is recompiled and its .class file placed in target folder. With "Automatic Publishing" enabled the .class files from target folder above ARE copied over to wtpwebapps folder, whereas with that option disabled there is no copying over.

"Automatic Publishing" doesn't also mean that the application is redeployed on Tomcat, its updated .class files and other files are updated in the wtpwebapps folder, as well.

What you do need to disable in Tomcat, though, is the "Auto Reload" option for your web module. Double-click on the Tomcat Server created in Eclipse, go to "Modules" tab, click on your web app web module, then click on "Edit..." and uncheck "Auto reloading enabled". Save and restart your Tomcat.


I have a spring mvc project. I use eclipse to write code but do not use it to run or test the application. Hot deployment with my setup works perfectly. I will give the steps to set this up.

Step #1

Download Spring Loaded Jar from here

Step #2

Edit your maven batch / shell file and add this line

export MAVEN_OPTS="-javaagent:/path/to/your/jar/springloaded-1.2.1.RELEASE.jar -noverify"

Step #3

Turn on Build Automatically in eclipse [menu: Project -> Build Automatically]

Step #4

Configure you pom to use tomcat plugin

<plugin>    <groupId>org.apache.tomcat.maven</groupId>    <artifactId>tomcat7-maven-plugin</artifactId>    <version>2.0</version>    <executions>      <execution>      <id>run-embedded</id>      <goals>        <goal>run</goal>      </goals>   <phase>pre-integration-test</phase>   <configuration>    <useSeparateTomcatClassLoader>true</useSeparateTomcatClassLoader>    <contextFile>${basedir}/tomcat/context.xml</contextFile>   </configuration>  </execution> </executions></plugin>

Step #5

Run you app using mvn tomcat:run