Reputation: 3975
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.
Upvotes: 14
Views: 5634
Reputation: 63
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
Upvotes: 0
Reputation: 3689
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:
Automatically publish when resources change
disabled
.VMWare vFabric tc Server 2.6+ (packaged with STS 2.9+) provides two options:
Upvotes: 0
Reputation: 1823
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:
Upvotes: 0
Reputation: 33735
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:
Hope that helps.
Upvotes: 4
Reputation: 120811
No there is no such configuration for Spring MVC. But it is a good idea for an feature request.
Upvotes: 8