diff --git a/pom.xml b/pom.xml index 9f1641d..1cdce61 100644 --- a/pom.xml +++ b/pom.xml @@ -11,8 +11,7 @@ spring-boot-demo-helloworld spring-boot-demo-properties spring-boot-demo-actuator - spring-boot-demo-admin-client - spring-boot-demo-admin-server + spring-boot-demo-admin spring-boot-demo-logback spring-boot-demo-log-aop spring-boot-demo-exception-handler @@ -163,4 +162,4 @@ - \ No newline at end of file + diff --git a/spring-boot-demo-admin-client/README.md b/spring-boot-demo-admin-client/README.md deleted file mode 100644 index c51e20a..0000000 --- a/spring-boot-demo-admin-client/README.md +++ /dev/null @@ -1,117 +0,0 @@ -# spring-boot-demo-admin-client - -> 本 demo 主要演示了普通项目如何集成 Spring Boot Admin,并把自己的运行状态交给 Spring Boot Admin 进行展现。 - -## pom.xml - -```xml - - - 4.0.0 - - spring-boot-demo-admin-client - 1.0.0-SNAPSHOT - jar - - spring-boot-demo-admin-client - Demo project for Spring Boot - - - com.xkcoding - spring-boot-demo - 1.0.0-SNAPSHOT - - - - UTF-8 - UTF-8 - 1.8 - 2.0.3 - - - - - org.springframework.boot - spring-boot-starter-web - - - - de.codecentric - spring-boot-admin-starter-client - - - - org.springframework.boot - spring-boot-starter-security - - - - org.springframework.boot - spring-boot-starter-test - test - - - - - - - de.codecentric - spring-boot-admin-dependencies - ${spring-boot-admin.version} - pom - import - - - - - - spring-boot-demo-admin-client - - - org.springframework.boot - spring-boot-maven-plugin - - - - - -``` - -## application.yml - -```yaml -server: - port: 8080 - servlet: - context-path: /demo -spring: - application: - # Spring Boot Admin展示的客户端项目名,不设置,会使用自动生成的随机id - name: spring-boot-demo-admin-client - boot: - admin: - client: - # Spring Boot Admin 服务端地址 - url: "http://localhost:8000/admin" - instance: - metadata: - # 客户端端点信息的安全认证信息 - user.name: ${spring.security.user.name} - user.password: ${spring.security.user.password} - security: - user: - name: xkcoding - password: 123456 -management: - endpoint: - health: - # 端点健康情况,默认值"never",设置为"always"可以显示硬盘使用情况和线程情况 - show-details: always - endpoints: - web: - exposure: - # 设置端点暴露的哪些内容,默认["health","info"],设置"*"代表暴露所有可访问的端点 - include: "*" -``` - diff --git a/spring-boot-demo-admin-client/pom.xml b/spring-boot-demo-admin-client/pom.xml deleted file mode 100644 index 9b8d814..0000000 --- a/spring-boot-demo-admin-client/pom.xml +++ /dev/null @@ -1,71 +0,0 @@ - - - 4.0.0 - - spring-boot-demo-admin-client - 1.0.0-SNAPSHOT - jar - - spring-boot-demo-admin-client - Demo project for Spring Boot - - - com.xkcoding - spring-boot-demo - 1.0.0-SNAPSHOT - - - - UTF-8 - UTF-8 - 1.8 - 2.1.0 - - - - - org.springframework.boot - spring-boot-starter-web - - - - de.codecentric - spring-boot-admin-starter-client - - - - org.springframework.boot - spring-boot-starter-security - - - - org.springframework.boot - spring-boot-starter-test - test - - - - - - - de.codecentric - spring-boot-admin-dependencies - ${spring-boot-admin.version} - pom - import - - - - - - spring-boot-demo-admin-client - - - org.springframework.boot - spring-boot-maven-plugin - - - - - diff --git a/spring-boot-demo-admin-server/README.md b/spring-boot-demo-admin-server/README.md deleted file mode 100644 index 6b94a44..0000000 --- a/spring-boot-demo-admin-server/README.md +++ /dev/null @@ -1,113 +0,0 @@ -# spring-boot-demo-admin-server - -> 本 demo 主要演示了如何搭建一个 Spring Boot Admin 的服务端项目,可视化展示自己客户端项目的运行状态。 - -## pom.xml - -```xml - - - 4.0.0 - - spring-boot-demo-admin-server - 1.0.0-SNAPSHOT - jar - - spring-boot-demo-admin-server - Demo project for Spring Boot - - - com.xkcoding - spring-boot-demo - 1.0.0-SNAPSHOT - - - - UTF-8 - UTF-8 - 1.8 - 2.0.3 - - - - - org.springframework.boot - spring-boot-starter-web - - - - de.codecentric - spring-boot-admin-starter-server - - - - org.springframework.boot - spring-boot-starter-test - test - - - - - - - de.codecentric - spring-boot-admin-dependencies - ${spring-boot-admin.version} - pom - import - - - - - - spring-boot-demo-admin-server - - - org.springframework.boot - spring-boot-maven-plugin - - - - - -``` - -## SpringBootDemoAdminServerApplication.java - -```java -/** - *

- * 启动类 - *

- * - * @package: com.xkcoding.admin.server - * @description: 启动类 - * @author: yangkai.shen - * @date: Created in 2018/10/8 2:08 PM - * @copyright: Copyright (c) 2018 - * @version: V1.0 - * @modified: yangkai.shen - */ -@EnableAdminServer -@SpringBootApplication -public class SpringBootDemoAdminServerApplication { - - public static void main(String[] args) { - SpringApplication.run(SpringBootDemoAdminServerApplication.class, args); - } -} -``` - -## application.yml - -```yaml -server: - port: 8000 -spring: - boot: - admin: - # 管控台上下文路径 - context-path: /admin -``` - diff --git a/spring-boot-demo-admin-server/pom.xml b/spring-boot-demo-admin-server/pom.xml deleted file mode 100644 index effb312..0000000 --- a/spring-boot-demo-admin-server/pom.xml +++ /dev/null @@ -1,66 +0,0 @@ - - - 4.0.0 - - spring-boot-demo-admin-server - 1.0.0-SNAPSHOT - jar - - spring-boot-demo-admin-server - Demo project for Spring Boot - - - com.xkcoding - spring-boot-demo - 1.0.0-SNAPSHOT - - - - UTF-8 - UTF-8 - 1.8 - 2.1.0 - - - - - org.springframework.boot - spring-boot-starter-web - - - - de.codecentric - spring-boot-admin-starter-server - - - - org.springframework.boot - spring-boot-starter-test - test - - - - - - - de.codecentric - spring-boot-admin-dependencies - ${spring-boot-admin.version} - pom - import - - - - - - spring-boot-demo-admin-server - - - org.springframework.boot - spring-boot-maven-plugin - - - - - diff --git a/spring-boot-demo-admin-server/src/main/resources/application.yml b/spring-boot-demo-admin-server/src/main/resources/application.yml deleted file mode 100644 index ef345d4..0000000 --- a/spring-boot-demo-admin-server/src/main/resources/application.yml +++ /dev/null @@ -1,9 +0,0 @@ -server: - port: 8000 - servlet: - context-path: /admin -spring: - boot: - admin: - # 管控台上下文路径 - context-path: / diff --git a/spring-boot-demo-admin/README.md b/spring-boot-demo-admin/README.md new file mode 100644 index 0000000..d46f30f --- /dev/null +++ b/spring-boot-demo-admin/README.md @@ -0,0 +1,51 @@ +# spring-boot-demo-admin + +> 本 demo 主要演示了 Spring Boot 如何集成 Admin 管控台,监控管理 Spring Boot 应用,分别为 admin 服务端和 admin 客户端,两个模块。 + +## 运行步骤 + +1. 进入 `spring-boot-demo-admin-server` 服务端,启动管控台服务端程序 +2. 进入 `spring-boot-demo-admin-client` 客户端,启动客户端程序,注册到服务端 +3. 观察服务端里,客户端程序的运行状态等信息 + +## pom.xml + +```xml + + + + spring-boot-demo + com.xkcoding + 1.0.0-SNAPSHOT + + 4.0.0 + + spring-boot-demo-admin + pom + + + 2.1.0 + + + + spring-boot-demo-admin-client + spring-boot-demo-admin-server + + + + + + de.codecentric + spring-boot-admin-dependencies + ${spring-boot-admin.version} + pom + import + + + + + +``` + diff --git a/spring-boot-demo-admin/pom.xml b/spring-boot-demo-admin/pom.xml new file mode 100644 index 0000000..6d1db69 --- /dev/null +++ b/spring-boot-demo-admin/pom.xml @@ -0,0 +1,36 @@ + + + + spring-boot-demo + com.xkcoding + 1.0.0-SNAPSHOT + + 4.0.0 + + spring-boot-demo-admin + pom + + + 2.1.0 + + + + spring-boot-demo-admin-client + spring-boot-demo-admin-server + + + + + + de.codecentric + spring-boot-admin-dependencies + ${spring-boot-admin.version} + pom + import + + + + + diff --git a/spring-boot-demo-admin-client/.gitignore b/spring-boot-demo-admin/spring-boot-demo-admin-client/.gitignore similarity index 100% rename from spring-boot-demo-admin-client/.gitignore rename to spring-boot-demo-admin/spring-boot-demo-admin-client/.gitignore diff --git a/spring-boot-demo-admin/spring-boot-demo-admin-client/README.md b/spring-boot-demo-admin/spring-boot-demo-admin-client/README.md new file mode 100644 index 0000000..65a20c1 --- /dev/null +++ b/spring-boot-demo-admin/spring-boot-demo-admin-client/README.md @@ -0,0 +1,104 @@ +# spring-boot-demo-admin-client + +> 本 demo 主要演示了普通项目如何集成 Spring Boot Admin,并把自己的运行状态交给 Spring Boot Admin 进行展现。 + +## pom.xml + +```xml + + + 4.0.0 + + spring-boot-demo-admin-client + 1.0.0-SNAPSHOT + jar + + spring-boot-demo-admin-client + Demo project for Spring Boot + + + com.xkcoding + spring-boot-demo-admin + 1.0.0-SNAPSHOT + + + + UTF-8 + UTF-8 + 1.8 + + + + + org.springframework.boot + spring-boot-starter-web + + + + de.codecentric + spring-boot-admin-starter-client + + + + org.springframework.boot + spring-boot-starter-security + + + + org.springframework.boot + spring-boot-starter-test + test + + + + + spring-boot-demo-admin-client + + + org.springframework.boot + spring-boot-maven-plugin + + + + + +``` + +## application.yml + +```yaml +server: + port: 8080 + servlet: + context-path: /demo +spring: + application: + # Spring Boot Admin展示的客户端项目名,不设置,会使用自动生成的随机id + name: spring-boot-demo-admin-client + boot: + admin: + client: + # Spring Boot Admin 服务端地址 + url: "http://localhost:8000/" + instance: + metadata: + # 客户端端点信息的安全认证信息 + user.name: ${spring.security.user.name} + user.password: ${spring.security.user.password} + security: + user: + name: xkcoding + password: 123456 +management: + endpoint: + health: + # 端点健康情况,默认值"never",设置为"always"可以显示硬盘使用情况和线程情况 + show-details: always + endpoints: + web: + exposure: + # 设置端点暴露的哪些内容,默认["health","info"],设置"*"代表暴露所有可访问的端点 + include: "*" +``` + diff --git a/spring-boot-demo-admin/spring-boot-demo-admin-client/pom.xml b/spring-boot-demo-admin/spring-boot-demo-admin-client/pom.xml new file mode 100644 index 0000000..53327a6 --- /dev/null +++ b/spring-boot-demo-admin/spring-boot-demo-admin-client/pom.xml @@ -0,0 +1,58 @@ + + + 4.0.0 + + spring-boot-demo-admin-client + 1.0.0-SNAPSHOT + jar + + spring-boot-demo-admin-client + Demo project for Spring Boot + + + com.xkcoding + spring-boot-demo-admin + 1.0.0-SNAPSHOT + + + + UTF-8 + UTF-8 + 1.8 + + + + + org.springframework.boot + spring-boot-starter-web + + + + de.codecentric + spring-boot-admin-starter-client + + + + org.springframework.boot + spring-boot-starter-security + + + + org.springframework.boot + spring-boot-starter-test + test + + + + + spring-boot-demo-admin-client + + + org.springframework.boot + spring-boot-maven-plugin + + + + + diff --git a/spring-boot-demo-admin-client/src/main/java/com/xkcoding/admin/client/SpringBootDemoAdminClientApplication.java b/spring-boot-demo-admin/spring-boot-demo-admin-client/src/main/java/com/xkcoding/admin/client/SpringBootDemoAdminClientApplication.java similarity index 100% rename from spring-boot-demo-admin-client/src/main/java/com/xkcoding/admin/client/SpringBootDemoAdminClientApplication.java rename to spring-boot-demo-admin/spring-boot-demo-admin-client/src/main/java/com/xkcoding/admin/client/SpringBootDemoAdminClientApplication.java diff --git a/spring-boot-demo-admin-client/src/main/java/com/xkcoding/admin/client/controller/IndexController.java b/spring-boot-demo-admin/spring-boot-demo-admin-client/src/main/java/com/xkcoding/admin/client/controller/IndexController.java similarity index 100% rename from spring-boot-demo-admin-client/src/main/java/com/xkcoding/admin/client/controller/IndexController.java rename to spring-boot-demo-admin/spring-boot-demo-admin-client/src/main/java/com/xkcoding/admin/client/controller/IndexController.java diff --git a/spring-boot-demo-admin-client/src/main/resources/application.yml b/spring-boot-demo-admin/spring-boot-demo-admin-client/src/main/resources/application.yml similarity index 93% rename from spring-boot-demo-admin-client/src/main/resources/application.yml rename to spring-boot-demo-admin/spring-boot-demo-admin-client/src/main/resources/application.yml index fd32c12..69a1f9a 100644 --- a/spring-boot-demo-admin-client/src/main/resources/application.yml +++ b/spring-boot-demo-admin/spring-boot-demo-admin-client/src/main/resources/application.yml @@ -10,7 +10,7 @@ spring: admin: client: # Spring Boot Admin 服务端地址 - url: "http://localhost:8000/admin" + url: "http://localhost:8000/" instance: metadata: # 客户端端点信息的安全认证信息 @@ -29,4 +29,4 @@ management: web: exposure: # 设置端点暴露的哪些内容,默认["health","info"],设置"*"代表暴露所有可访问的端点 - include: "*" \ No newline at end of file + include: "*" diff --git a/spring-boot-demo-admin-client/src/test/java/com/xkcoding/admin/client/SpringBootDemoAdminClientApplicationTests.java b/spring-boot-demo-admin/spring-boot-demo-admin-client/src/test/java/com/xkcoding/admin/client/SpringBootDemoAdminClientApplicationTests.java similarity index 100% rename from spring-boot-demo-admin-client/src/test/java/com/xkcoding/admin/client/SpringBootDemoAdminClientApplicationTests.java rename to spring-boot-demo-admin/spring-boot-demo-admin-client/src/test/java/com/xkcoding/admin/client/SpringBootDemoAdminClientApplicationTests.java diff --git a/spring-boot-demo-admin-server/.gitignore b/spring-boot-demo-admin/spring-boot-demo-admin-server/.gitignore similarity index 100% rename from spring-boot-demo-admin-server/.gitignore rename to spring-boot-demo-admin/spring-boot-demo-admin-server/.gitignore diff --git a/spring-boot-demo-admin/spring-boot-demo-admin-server/README.md b/spring-boot-demo-admin/spring-boot-demo-admin-server/README.md new file mode 100644 index 0000000..9600eb8 --- /dev/null +++ b/spring-boot-demo-admin/spring-boot-demo-admin-server/README.md @@ -0,0 +1,95 @@ +# spring-boot-demo-admin-server + +> 本 demo 主要演示了如何搭建一个 Spring Boot Admin 的服务端项目,可视化展示自己客户端项目的运行状态。 + +## pom.xml + +```xml + + + 4.0.0 + + spring-boot-demo-admin-server + 1.0.0-SNAPSHOT + jar + + spring-boot-demo-admin-server + Demo project for Spring Boot + + + com.xkcoding + spring-boot-demo-admin + 1.0.0-SNAPSHOT + + + + UTF-8 + UTF-8 + 1.8 + + + + + org.springframework.boot + spring-boot-starter-web + + + + de.codecentric + spring-boot-admin-starter-server + + + + org.springframework.boot + spring-boot-starter-test + test + + + + + spring-boot-demo-admin-server + + + org.springframework.boot + spring-boot-maven-plugin + + + + + +``` + +## SpringBootDemoAdminServerApplication.java + +```java +/** + *

+ * 启动类 + *

+ * + * @package: com.xkcoding.admin.server + * @description: 启动类 + * @author: yangkai.shen + * @date: Created in 2018/10/8 2:08 PM + * @copyright: Copyright (c) 2018 + * @version: V1.0 + * @modified: yangkai.shen + */ +@EnableAdminServer +@SpringBootApplication +public class SpringBootDemoAdminServerApplication { + + public static void main(String[] args) { + SpringApplication.run(SpringBootDemoAdminServerApplication.class, args); + } +} +``` + +## application.yml + +```yaml +server: + port: 8000 +``` + diff --git a/spring-boot-demo-admin/spring-boot-demo-admin-server/pom.xml b/spring-boot-demo-admin/spring-boot-demo-admin-server/pom.xml new file mode 100644 index 0000000..18b3050 --- /dev/null +++ b/spring-boot-demo-admin/spring-boot-demo-admin-server/pom.xml @@ -0,0 +1,53 @@ + + + 4.0.0 + + spring-boot-demo-admin-server + 1.0.0-SNAPSHOT + jar + + spring-boot-demo-admin-server + Demo project for Spring Boot + + + com.xkcoding + spring-boot-demo-admin + 1.0.0-SNAPSHOT + + + + UTF-8 + UTF-8 + 1.8 + + + + + org.springframework.boot + spring-boot-starter-web + + + + de.codecentric + spring-boot-admin-starter-server + + + + org.springframework.boot + spring-boot-starter-test + test + + + + + spring-boot-demo-admin-server + + + org.springframework.boot + spring-boot-maven-plugin + + + + + diff --git a/spring-boot-demo-admin-server/src/main/java/com/xkcoding/admin/server/SpringBootDemoAdminServerApplication.java b/spring-boot-demo-admin/spring-boot-demo-admin-server/src/main/java/com/xkcoding/admin/server/SpringBootDemoAdminServerApplication.java similarity index 100% rename from spring-boot-demo-admin-server/src/main/java/com/xkcoding/admin/server/SpringBootDemoAdminServerApplication.java rename to spring-boot-demo-admin/spring-boot-demo-admin-server/src/main/java/com/xkcoding/admin/server/SpringBootDemoAdminServerApplication.java diff --git a/spring-boot-demo-admin/spring-boot-demo-admin-server/src/main/resources/application.yml b/spring-boot-demo-admin/spring-boot-demo-admin-server/src/main/resources/application.yml new file mode 100644 index 0000000..00cff46 --- /dev/null +++ b/spring-boot-demo-admin/spring-boot-demo-admin-server/src/main/resources/application.yml @@ -0,0 +1,2 @@ +server: + port: 8000 diff --git a/spring-boot-demo-admin-server/src/test/java/com/xkcoding/admin/server/SpringBootDemoAdminServerApplicationTests.java b/spring-boot-demo-admin/spring-boot-demo-admin-server/src/test/java/com/xkcoding/admin/server/SpringBootDemoAdminServerApplicationTests.java similarity index 100% rename from spring-boot-demo-admin-server/src/test/java/com/xkcoding/admin/server/SpringBootDemoAdminServerApplicationTests.java rename to spring-boot-demo-admin/spring-boot-demo-admin-server/src/test/java/com/xkcoding/admin/server/SpringBootDemoAdminServerApplicationTests.java