diff --git a/spring-boot-demo-actuator/.gitignore b/spring-boot-demo-actuator/.gitignore
new file mode 100644
index 0000000..82eca33
--- /dev/null
+++ b/spring-boot-demo-actuator/.gitignore
@@ -0,0 +1,25 @@
+/target/
+!.mvn/wrapper/maven-wrapper.jar
+
+### STS ###
+.apt_generated
+.classpath
+.factorypath
+.project
+.settings
+.springBeans
+.sts4-cache
+
+### IntelliJ IDEA ###
+.idea
+*.iws
+*.iml
+*.ipr
+
+### NetBeans ###
+/nbproject/private/
+/build/
+/nbbuild/
+/dist/
+/nbdist/
+/.nb-gradle/
\ No newline at end of file
diff --git a/spring-boot-demo-actuator/README.md b/spring-boot-demo-actuator/README.md
new file mode 100644
index 0000000..0f2ae1e
--- /dev/null
+++ b/spring-boot-demo-actuator/README.md
@@ -0,0 +1,109 @@
+# spring-boot-demo-actuator
+
+> 本 demo 主要演示了如何在 Spring Boot 中通过 actuator 检查项目运行情况
+
+## pom.xml
+
+```xml
+
+
+ * 启动类 + *
+ * + * @package: com.xkcoding.actuator + * @description: 启动类 + * @author: yangkai.shen + * @date: Created in 2018/9/29 2:27 PM + * @copyright: Copyright (c)2018 + * @version: V1.0 + * @modified: yangkai.shen + */ +@SpringBootApplication +public class SpringBootDemoActuatorApplication { + + public static void main(String[] args) { + SpringApplication.run(SpringBootDemoActuatorApplication.class, args); + } +} diff --git a/spring-boot-demo-actuator/src/main/resources/application.yml b/spring-boot-demo-actuator/src/main/resources/application.yml new file mode 100644 index 0000000..d1dbefe --- /dev/null +++ b/spring-boot-demo-actuator/src/main/resources/application.yml @@ -0,0 +1,25 @@ +server: + port: 8080 + servlet: + context-path: /demo +# 若要访问端点信息,需要配置用户名和密码 +spring: + security: + user: + name: xkcoding + password: 123456 +management: + # 端点信息接口使用的端口,为了和主系统接口使用的端口进行分离 + server: + port: 8090 + servlet: + context-path: /sys + # 端点健康情况,默认值"never",设置为"always"可以显示硬盘使用情况和线程情况 + endpoint: + health: + show-details: always + # 设置端点暴露的哪些内容,默认["health","info"],设置"*"代表暴露所有可访问的端点 + endpoints: + web: + exposure: + include: '*' \ No newline at end of file diff --git a/spring-boot-demo-actuator/src/test/java/com/xkcoding/actuator/SpringBootDemoActuatorApplicationTests.java b/spring-boot-demo-actuator/src/test/java/com/xkcoding/actuator/SpringBootDemoActuatorApplicationTests.java new file mode 100644 index 0000000..4416b96 --- /dev/null +++ b/spring-boot-demo-actuator/src/test/java/com/xkcoding/actuator/SpringBootDemoActuatorApplicationTests.java @@ -0,0 +1,16 @@ +package com.xkcoding.actuator; + +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 SpringBootDemoActuatorApplicationTests { + + @Test + public void contextLoads() { + } + +}