Reputation: 11
In Spring boot application how to stop tomcat from restarting again and again when code is changed.
Thanks Sunil
Upvotes: 0
Views: 869
Reputation: 5251
This dependency is probably somewhere in your POM.xml:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
It is used for exactly the behavior you are describing, 'not having to restart the server manually' during development.
It is automatically disabled and not present in a production build.
If you don't like it just remove the dependency from your POM.xml and load maven changes.
There are probably also some settings in you IDE that could turn this behavior off temporarily. If you use IntelliJ:
Under: File
->settings
->build,execution,deployment
->compiler
Turn off the building of the project automatically
OR:
Ctrl+SHIFT+A->registry
Turn off compiler.automake.allow.when.app.running
In Eclipse or Spring tool suite:
Under: Project
Uncheck Build Automatically
Upvotes: 1
Reputation: 1123
The problem can be because of the devtools that you added in your pom.xml.
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
Just remove this dependency and update the project.
Another solution can be, if you use Eclipse or spring tool suite , you can uncheck this option
Upvotes: 1