Springboot shutdown automatically and restart automatically .
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 |
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 '18 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 '18 at 2:05
add a comment |
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 '18 at 1:57
JunHui LiJunHui Li
6
6
1
Are you using spring-boot-devtools dependency in your pom.xml file?
– Hrudayanath
Nov 13 '18 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 '18 at 2:05
add a comment |
1
Are you using spring-boot-devtools dependency in your pom.xml file?
– Hrudayanath
Nov 13 '18 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 '18 at 2:05
1
1
Are you using spring-boot-devtools dependency in your pom.xml file?
– Hrudayanath
Nov 13 '18 at 2:04
Are you using spring-boot-devtools dependency in your pom.xml file?
– Hrudayanath
Nov 13 '18 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 '18 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 '18 at 2:05
add a comment |
2 Answers
2
active
oldest
votes
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 '18 at 4:05
Thanks, I already solved this problem. it might be the same as your solution:
– JunHui Li
Nov 15 '18 at 2:05
add a comment |
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 |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
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
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
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 '18 at 4:05
Thanks, I already solved this problem. it might be the same as your solution:
– JunHui Li
Nov 15 '18 at 2:05
add a comment |
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 '18 at 4:05
Thanks, I already solved this problem. it might be the same as your solution:
– JunHui Li
Nov 15 '18 at 2:05
add a comment |
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 '18 at 2:37
answered Nov 13 '18 at 2:15
HrudayanathHrudayanath
13310
13310
Please provide the scope as runtime : <scope>runtime</scope>
– Lova Chittumuri
Nov 13 '18 at 4:05
Thanks, I already solved this problem. it might be the same as your solution:
– JunHui Li
Nov 15 '18 at 2:05
add a comment |
Please provide the scope as runtime : <scope>runtime</scope>
– Lova Chittumuri
Nov 13 '18 at 4:05
Thanks, I already solved this problem. it might be the same as your solution:
– JunHui Li
Nov 15 '18 at 2:05
Please provide the scope as runtime : <scope>runtime</scope>
– Lova Chittumuri
Nov 13 '18 at 4:05
Please provide the scope as runtime : <scope>runtime</scope>
– Lova Chittumuri
Nov 13 '18 at 4:05
Thanks, I already solved this problem. it might be the same as your solution:
– JunHui Li
Nov 15 '18 at 2:05
Thanks, I already solved this problem. it might be the same as your solution:
– JunHui Li
Nov 15 '18 at 2:05
add a comment |
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 |
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 |
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 '18 at 3:10
VuNTVuNT
12
12
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
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 '18 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 '18 at 2:05