Is there any development mode in Spring like in Struts. In Struts if we set dev mode to true all the configuration files are loaded in every request. However now when I'm developing in Spring MVC, I have to restart server after every change. Or is there some other method by which I can force reload.
-
1May be you can use feature from an IDE having the option autodeploy – Moinul Hossain Jan 25 '12 at 07:25
-
@Rifat that I'm using. But that's not solving my problem. Now I'm having to stop tomcat, rebuild, and start the tomcat again. Autodeploy is happening but still some problem is there. – Akhil K Nambiar Jan 25 '12 at 07:41
-
3You don't need to rebuild, and restart webserver, set up you ide to hot deploy correctly http://stackoverflow.com/a/6189031/106261 – NimChimpsky Jan 25 '12 at 09:10
5 Answers
No there is no such configuration for Spring MVC. But it is a good idea for an feature request.

- 118,862
- 56
- 287
- 383
Answering both of your questions and keeping it short.
No, there is nothing like a devmode in Spring framework so you can throw it out of your head.
Yes, you could skip reloading by using some bytecode manipulation techniques. You can use either:
- external tool (like JRebel or Javaleon)
- server with hot deployment (like Jetty)
- IDE (some IDEs offer such functionalities as well)
Hope that helps.

- 33,595
- 11
- 64
- 74
Yes: If you are using Tomcat or a derivative (VMWare vFabric tc Server), you can configure application reload behavior (hot deploy). This allows changes to say a method to be reloaded without restart. The key is to set:
- Publishing set to
Automatically publish when resources change
- Your web module set to Auto Reload
disabled
.
VMWare vFabric tc Server 2.6+ (packaged with STS 2.9+) provides two options:
- Java Agent-based reloading
- JMX-based reloading

- 3,792
- 7
- 45
- 65
If you are using Spring Boot, then all you need to do is add the dependency devtools to your project. This allow you to have your application deployed each time you modify a classpath file.
maven
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
</dependencies>
Gradle:
dependencies {
compileOnly("org.springframework.boot:spring-boot-devtools")
}
Spring docs: Spring boot devtools

- 49,934
- 160
- 51
- 83

- 45
- 1
- 9
What change you refer to? Template changes?
Even with struts, JSP and velocity templates shouldn't reload the servlet container. Only Java classes would do that.
I have written a blog post Spring-mvc + Velocity + DCEVM about how to use Spring + Velocity + Dynamic Code Evolution VM (DCEVM) in order to not restart the server when developing:

- 3,452
- 1
- 26
- 23

- 1,823
- 21
- 28