Spring Uploaded: integration with Spring MVC maven project

I just stumbled upon a Spring Loaded project on a Spring website. I am trying to integrate this into Spring MVC (using Maven and TOMCAT) that I have been working on.

Following the instructions on the project page, I downloaded the JAR file and added the following to the VM TOMCAT (Inside Eclipse) arguments:

-javaagent:C:\Users\xxx\Downloads\springloaded-1.2.0.RELEASE.jar -noverify 

I also turned off automatic publishing to TOMCAT.

Now, as soon as I run TOMCAT and make any changes to the controllers (or any other classes), I see no hot deployment. Is there something that I'm wrong, or is another configuration needed?

Any inputs will be appreciated.

+7
spring spring-mvc maven tomcat spring-loaded
source share
5 answers

I tried SpringLoaded to quickly demonstrate using Petclinic on top of Aptache Tomcat 7 during this week, encountering the same problem that was discussed here. Finally, I found that I needed to add a project to the Tomcat path. Therefore, in my case, I opened the "launch Tomcat configuration" in Eclipse, and on the classpath tab, I added my project to the "user records" group. This causes the effect of spring work.

+5
source share

You need “Automatically publish” to Tomcat because modified .class files are not copied to the temporary folder where Tomcat has the application deployed to.

For example, in my local instance, the temporary deployment folder is Tomcat [WORKSPACE_FOLDER]\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps . In this folder, my Eclipse web application resources (classes and other files) are copied, and this is where Tomcat collects them for deployment. Although my Eclipse web application has its own .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 is placed in the target folder. Using the Auto Publish function, the .class files from the target folder above ARE are copied to the wtpwebapps folder, while copying is disabled when the option is disabled.

"Automatic publishing" also does not mean that the application is redistributed to Tomcat, its updated .class files and other files are also updated in the wtpwebapps folder.

However, you need to disable it in Tomcat, this is the "Auto-reboot" option for your web module. Double-click on the Tomcat server created in Eclipse, go to the "Modules" tab, click the web application web module, then click "Change ..." and uncheck "Automatically restart enabled". Save and restart Tomcat.

+4
source share

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

Step 1

Download spring Uploaded jar from here

Step # 2

Edit the match batch / shell file and add this line to

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

Step # 3

Enable automatic build in eclipse [menu: Project → Build Automatically]

Step # 4

Configure 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 number 5

Launch the application using mvn tomcat:run

+1
source share

If you want to integrate Spring-Loader, you need to add

 <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <dependencies> <dependency> <groupId>org.springframework</groupId> <artifactId>springloaded</artifactId> <version>1.2.3.RELEASE</version> </dependency> </dependencies> </plugin> 

in pom.xml

What is it. Hooray!!!

0
source share

I have a spring mvc project, tomcat7-maven. I use eclipse to write code. I set up my project as follows:

Step # 1 : pom.xml

 <plugin> <groupId>org.apache.tomcat.maven</groupId> <artifactId>tomcat7-maven-plugin</artifactId> <version>2.2</version> <!-- Config: contextPath and Port (Default: / : 8080) --> <configuration> <path>/</path> <port>8080</port> </configuration> </plugin> 

Step # 2

Download spring A loaded jar from here : springloaded-1.2.5.RELEASE.jar

Step # 3

Right-click your project -> Run As -> Run Configurations ... -> Maven Build -> Create ->

Main Tab:

  • Name: Your configuration name
  • Base directory: $ {workspace_loc: / YourProjectName}
  • Goals: tomcat7: run -X

Tab Arguments: In VM Arguments: -javaagent: path / to / library / springloaded-1.2.5.RELEASE.jar -noverify

→ Run

Now you can change the source code and see the changes right away. Just reload the page in a web browser without rebuilding your project (automatically create Eclipse) and reload the web server.

0
source share

All Articles