简体   繁体   中英

Spring boot hot reload

I'm using spring boot and uses the fat jar for production, which is pretty cool.

However, the way I'm deploying forces the application to be shutdown for about 15 seconds when redeploying, because I have to kill the running jar and start the new one. I haven't found any solutions for this, ie how to reload the new jar without a restart.

Is it possible to "hot reload/replace" the jar or would I have to run in a container, like tomcat, and deploying a war?

Please note that it's in production so I guess dev-tools is out of question.

It's more infrastructure question I guess. You can create second "reserve"instance running your app. When you are updating your app on the main instance - all users requests must be redirected to the second "reserve" instance. When the redeploy is finished - you redirect the request to the main instance again. And then redeploy app on the reserve instance. For example Nginx may help you with those redirections.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM