Springboot shutdown automatically and restart automatically .
up vote
0
down vote
favorite
I encounter a problem that my springboot project will shutdown and restart automatically.
Before that problem, the program finish schedule job, this scheduling job will read data from redis and then compare with local backup file, if any new data coming up, the program will write to local backup file.
The following part is the shutdown log
console log
java spring tomcat web
add a comment |
up vote
0
down vote
favorite
I encounter a problem that my springboot project will shutdown and restart automatically.
Before that problem, the program finish schedule job, this scheduling job will read data from redis and then compare with local backup file, if any new data coming up, the program will write to local backup file.
The following part is the shutdown log
console log
java spring tomcat web
1
Are you using spring-boot-devtools dependency in your pom.xml file?
– Hrudayanath
Nov 13 at 2:04
1
Yes, and thank you for your answering, I already solved this problem by Set theSystem.setProperty("spring.devtools.restart.enabled", "false");
– JunHui Li
Nov 15 at 2:05
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I encounter a problem that my springboot project will shutdown and restart automatically.
Before that problem, the program finish schedule job, this scheduling job will read data from redis and then compare with local backup file, if any new data coming up, the program will write to local backup file.
The following part is the shutdown log
console log
java spring tomcat web
I encounter a problem that my springboot project will shutdown and restart automatically.
Before that problem, the program finish schedule job, this scheduling job will read data from redis and then compare with local backup file, if any new data coming up, the program will write to local backup file.
The following part is the shutdown log
console log
java spring tomcat web
java spring tomcat web
asked Nov 13 at 1:57
JunHui Li
6
6
1
Are you using spring-boot-devtools dependency in your pom.xml file?
– Hrudayanath
Nov 13 at 2:04
1
Yes, and thank you for your answering, I already solved this problem by Set theSystem.setProperty("spring.devtools.restart.enabled", "false");
– JunHui Li
Nov 15 at 2:05
add a comment |
1
Are you using spring-boot-devtools dependency in your pom.xml file?
– Hrudayanath
Nov 13 at 2:04
1
Yes, and thank you for your answering, I already solved this problem by Set theSystem.setProperty("spring.devtools.restart.enabled", "false");
– JunHui Li
Nov 15 at 2:05
1
1
Are you using spring-boot-devtools dependency in your pom.xml file?
– Hrudayanath
Nov 13 at 2:04
Are you using spring-boot-devtools dependency in your pom.xml file?
– Hrudayanath
Nov 13 at 2:04
1
1
Yes, and thank you for your answering, I already solved this problem by Set the
System.setProperty("spring.devtools.restart.enabled", "false");
– JunHui Li
Nov 15 at 2:05
Yes, and thank you for your answering, I already solved this problem by Set the
System.setProperty("spring.devtools.restart.enabled", "false");
– JunHui Li
Nov 15 at 2:05
add a comment |
2 Answers
2
active
oldest
votes
up vote
3
down vote
Incase if you are using spring-boot-devtools dependency in your pom.xml file, when any new changes are made to existing project it will automatically restart the project. It helps in cases where on making minor changes, the project is automatically restarted and the application start time is also significantly small compared to normal scenario. If you don't wish to have this behavior you can just remove the following dependency from you pom.xml file, thereby there is no automatic restart of application.
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
Please provide the scope as runtime : <scope>runtime</scope>
– Lova Chittumuri
Nov 13 at 4:05
Thanks, I already solved this problem. it might be the same as your solution:
– JunHui Li
Nov 15 at 2:05
add a comment |
up vote
0
down vote
You can add the Shutdown hook in my application.
Java shutdown hook runs in these two cases.
- The program exits normally, or we call System.exit() method to terminate the program. Read more about Java System Class.
- User interrupts such as Ctrl+C, system shutdown etc.
Code:
Runtime.getRuntime().addShutdownHook(new Thread("Shutdownhook") {
public void run() {
//code here
//compare redis cache
//syn data and save local file.
try {
mainThread.join();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
instance.logger.error(e.getMessage(), e);
}
}
});
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
3
down vote
Incase if you are using spring-boot-devtools dependency in your pom.xml file, when any new changes are made to existing project it will automatically restart the project. It helps in cases where on making minor changes, the project is automatically restarted and the application start time is also significantly small compared to normal scenario. If you don't wish to have this behavior you can just remove the following dependency from you pom.xml file, thereby there is no automatic restart of application.
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
Please provide the scope as runtime : <scope>runtime</scope>
– Lova Chittumuri
Nov 13 at 4:05
Thanks, I already solved this problem. it might be the same as your solution:
– JunHui Li
Nov 15 at 2:05
add a comment |
up vote
3
down vote
Incase if you are using spring-boot-devtools dependency in your pom.xml file, when any new changes are made to existing project it will automatically restart the project. It helps in cases where on making minor changes, the project is automatically restarted and the application start time is also significantly small compared to normal scenario. If you don't wish to have this behavior you can just remove the following dependency from you pom.xml file, thereby there is no automatic restart of application.
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
Please provide the scope as runtime : <scope>runtime</scope>
– Lova Chittumuri
Nov 13 at 4:05
Thanks, I already solved this problem. it might be the same as your solution:
– JunHui Li
Nov 15 at 2:05
add a comment |
up vote
3
down vote
up vote
3
down vote
Incase if you are using spring-boot-devtools dependency in your pom.xml file, when any new changes are made to existing project it will automatically restart the project. It helps in cases where on making minor changes, the project is automatically restarted and the application start time is also significantly small compared to normal scenario. If you don't wish to have this behavior you can just remove the following dependency from you pom.xml file, thereby there is no automatic restart of application.
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
Incase if you are using spring-boot-devtools dependency in your pom.xml file, when any new changes are made to existing project it will automatically restart the project. It helps in cases where on making minor changes, the project is automatically restarted and the application start time is also significantly small compared to normal scenario. If you don't wish to have this behavior you can just remove the following dependency from you pom.xml file, thereby there is no automatic restart of application.
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
edited Nov 13 at 2:37
answered Nov 13 at 2:15
Hrudayanath
1239
1239
Please provide the scope as runtime : <scope>runtime</scope>
– Lova Chittumuri
Nov 13 at 4:05
Thanks, I already solved this problem. it might be the same as your solution:
– JunHui Li
Nov 15 at 2:05
add a comment |
Please provide the scope as runtime : <scope>runtime</scope>
– Lova Chittumuri
Nov 13 at 4:05
Thanks, I already solved this problem. it might be the same as your solution:
– JunHui Li
Nov 15 at 2:05
Please provide the scope as runtime : <scope>runtime</scope>
– Lova Chittumuri
Nov 13 at 4:05
Please provide the scope as runtime : <scope>runtime</scope>
– Lova Chittumuri
Nov 13 at 4:05
Thanks, I already solved this problem. it might be the same as your solution:
– JunHui Li
Nov 15 at 2:05
Thanks, I already solved this problem. it might be the same as your solution:
– JunHui Li
Nov 15 at 2:05
add a comment |
up vote
0
down vote
You can add the Shutdown hook in my application.
Java shutdown hook runs in these two cases.
- The program exits normally, or we call System.exit() method to terminate the program. Read more about Java System Class.
- User interrupts such as Ctrl+C, system shutdown etc.
Code:
Runtime.getRuntime().addShutdownHook(new Thread("Shutdownhook") {
public void run() {
//code here
//compare redis cache
//syn data and save local file.
try {
mainThread.join();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
instance.logger.error(e.getMessage(), e);
}
}
});
add a comment |
up vote
0
down vote
You can add the Shutdown hook in my application.
Java shutdown hook runs in these two cases.
- The program exits normally, or we call System.exit() method to terminate the program. Read more about Java System Class.
- User interrupts such as Ctrl+C, system shutdown etc.
Code:
Runtime.getRuntime().addShutdownHook(new Thread("Shutdownhook") {
public void run() {
//code here
//compare redis cache
//syn data and save local file.
try {
mainThread.join();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
instance.logger.error(e.getMessage(), e);
}
}
});
add a comment |
up vote
0
down vote
up vote
0
down vote
You can add the Shutdown hook in my application.
Java shutdown hook runs in these two cases.
- The program exits normally, or we call System.exit() method to terminate the program. Read more about Java System Class.
- User interrupts such as Ctrl+C, system shutdown etc.
Code:
Runtime.getRuntime().addShutdownHook(new Thread("Shutdownhook") {
public void run() {
//code here
//compare redis cache
//syn data and save local file.
try {
mainThread.join();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
instance.logger.error(e.getMessage(), e);
}
}
});
You can add the Shutdown hook in my application.
Java shutdown hook runs in these two cases.
- The program exits normally, or we call System.exit() method to terminate the program. Read more about Java System Class.
- User interrupts such as Ctrl+C, system shutdown etc.
Code:
Runtime.getRuntime().addShutdownHook(new Thread("Shutdownhook") {
public void run() {
//code here
//compare redis cache
//syn data and save local file.
try {
mainThread.join();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
instance.logger.error(e.getMessage(), e);
}
}
});
answered Nov 13 at 3:10
VuNT
12
12
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53272685%2fspringboot-shutdown-automatically-and-restart-automatically%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
Are you using spring-boot-devtools dependency in your pom.xml file?
– Hrudayanath
Nov 13 at 2:04
1
Yes, and thank you for your answering, I already solved this problem by Set the
System.setProperty("spring.devtools.restart.enabled", "false");
– JunHui Li
Nov 15 at 2:05