Spring boot application startup and shutdown mode __spring

Source: Internet
Author: User
Tags curl

First, spring boot boot mode

1, in the IDE to start the Spring Boot Application project Startup class Appplication.java Main method;

For example: @SpringBootApplicationpublic class Eurekaclientapplication {public static void main (string[] args) {new springapplic Ationbuilder (Eurekaclientapplication.class). Web (True). Run (args); }}

2. Use maven command Execution (MAVEN project) under the root directory of Spring boot application: mvn spring-boot:run

3, using the way to start the jar, the steps are as follows:

A, enter the spring boot application root directory;

B, Input command: MVN install-dmaven.test.skip=true

C, CD target

D, Java-jar ****.jar


Second, Spring boot application shutdown (Linux/unix/ubuntu environment)

A, non-security authentication 1, Project Pom.xml Add the following dependencies: <dependency> <groupId>org.springframework.boot</groupId> < Artifactid>spring-boot-starter-actuator</artifactid> </dependency> 2, The Application.properties file adds the following: #启用shutdownendpoints. shutdown.enabled=true# Disables password Authentication endpoints.shutdown.sensitive= False 3, Close command: Curl-x POST host:port/shutdown
B, security verification 1, pom.xml add the following dependencies: <dependency> <groupId>org.springframework.boot</groupId> <artifactid >spring-boot-starter-security</artifactId> </dependency> 2, application.properties files add the following: # Turn on Shutdown security Authentication endpoints.shutdown.sensitive=true# Verify username security.user.name=admin# authentication Password security.user.password= admin# role management.security.role=superuser# Specify port management.port=8081# Specify address management.address=127.0.0.1 3, shutdown command: Curl-u admin:admin-x POST Http://127.0.0.1:8081/manage/shutdown

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.