Spring boot application startup and shutdown method
Spring boot, as the product of the spring framework's best practice of the concept of "convention over configuration", can help us quickly create independently running, product level applications based on the spring framework. Most spring boot applications can run quickly with very little configuration, It is a micro framework that fits well with microservices.
1. Spring boot application packaging
Spring boot applications can be packaged into jar packages with embedded tomcat, so they can be started directly. However, before the spring boot application starts, it needs to be packaged. This article describes the packaging of Maven project. The prerequisites for packaging (content in pom.xml file) are:
The packaging command is:
Or run run - > Maven build... In eclipse, Fill in clean package - dmaven. In goals test. Skip = true, running, packaging completed.
2. Spring boot application startup
The start command of spring boot is:
3. Close the spring boot application
There are two main ways to close spring boot: Send a shutdown signal through HTTP or service stop.
POM is the prerequisite for closing the spring boot application XML add the following:
application. Add in properties:
The closing command is:
If you want to configure the path, you need to set the path in application Add management. In properties Context path = / manage, the shutdown command changes to curl - x post host: port / manage / shutdown.
4. Safety verification
If security verification is required when closing, it is required in POM Add to XML file:
application. Add in properties:
The closing command is:
The above is the whole content of this article. I hope it will be helpful to your study, and I hope you can support programming tips.