From 456f6114e516813b58dc92d1f1c3e14f7e319e64 Mon Sep 17 00:00:00 2001 From: mrbird <852252810@qq.com> Date: Mon, 7 May 2018 14:32:58 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BD=BF=E7=94=A8Actuator=E7=9B=91=E6=8E=A7Spr?= =?UTF-8?q?ing=20Boot=E5=BA=94=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 21.Spring-Boot-Actuator/pom.xml | 63 +++++++++++++++++++ .../com/springboot/demo/DemoApplication.java | 20 ++++++ .../src/main/resources/application.yml | 13 ++++ .../springboot/demo/DemoApplicationTests.java | 16 +++++ 4 files changed, 112 insertions(+) create mode 100644 21.Spring-Boot-Actuator/pom.xml create mode 100644 21.Spring-Boot-Actuator/src/main/java/com/springboot/demo/DemoApplication.java create mode 100644 21.Spring-Boot-Actuator/src/main/resources/application.yml create mode 100644 21.Spring-Boot-Actuator/src/test/java/com/springboot/demo/DemoApplicationTests.java diff --git a/21.Spring-Boot-Actuator/pom.xml b/21.Spring-Boot-Actuator/pom.xml new file mode 100644 index 0000000..b240d91 --- /dev/null +++ b/21.Spring-Boot-Actuator/pom.xml @@ -0,0 +1,63 @@ + + + 4.0.0 + + com.springboot + Spring-Boot-Actuator + 0.0.1-SNAPSHOT + jar + + Spring-Boot-Actuator + Demo project for Spring Boot + + + org.springframework.boot + spring-boot-starter-parent + 1.5.9.RELEASE + + + + + UTF-8 + UTF-8 + 1.7 + + + + + org.springframework.boot + spring-boot-starter-web + + + + org.springframework.boot + spring-boot-starter-test + test + + + + org.springframework.boot + spring-boot-starter-actuator + + + + + + nexus-aliyun + Nexus aliyun + http://maven.aliyun.com/nexus/content/groups/public + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + + diff --git a/21.Spring-Boot-Actuator/src/main/java/com/springboot/demo/DemoApplication.java b/21.Spring-Boot-Actuator/src/main/java/com/springboot/demo/DemoApplication.java new file mode 100644 index 0000000..e584ba8 --- /dev/null +++ b/21.Spring-Boot-Actuator/src/main/java/com/springboot/demo/DemoApplication.java @@ -0,0 +1,20 @@ +package com.springboot.demo; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@SpringBootApplication +public class DemoApplication { + + @RequestMapping("/") + String index() { + return "hello spring boot"; + } + + public static void main(String[] args) { + SpringApplication.run(DemoApplication.class, args); + } +} diff --git a/21.Spring-Boot-Actuator/src/main/resources/application.yml b/21.Spring-Boot-Actuator/src/main/resources/application.yml new file mode 100644 index 0000000..560eb80 --- /dev/null +++ b/21.Spring-Boot-Actuator/src/main/resources/application.yml @@ -0,0 +1,13 @@ +server: + port: 80 + +management: + security: + enabled: false #关掉安全认证 + port: 80 + context-path: /monitor #actuator的访问路径 +endpoints: + shutdown: + enabled: true + beans: + id: instances \ No newline at end of file diff --git a/21.Spring-Boot-Actuator/src/test/java/com/springboot/demo/DemoApplicationTests.java b/21.Spring-Boot-Actuator/src/test/java/com/springboot/demo/DemoApplicationTests.java new file mode 100644 index 0000000..228ddb8 --- /dev/null +++ b/21.Spring-Boot-Actuator/src/test/java/com/springboot/demo/DemoApplicationTests.java @@ -0,0 +1,16 @@ +package com.springboot.demo; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest +public class DemoApplicationTests { + + @Test + public void contextLoads() { + } + +}