From 4e0de645debd83cb2a37ac585d2347e718dc78e2 Mon Sep 17 00:00:00 2001 From: "Yangkai.Shen" <237497819@qq.com> Date: Mon, 8 Oct 2018 15:41:33 +0800 Subject: [PATCH] =?UTF-8?q?:sparkles:=20spring-boot-demo-admin-server=20?= =?UTF-8?q?=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- spring-boot-demo-admin-server/.gitignore | 25 ++++ spring-boot-demo-admin-server/README.md | 115 ++++++++++++++++++ spring-boot-demo-admin-server/pom.xml | 68 +++++++++++ .../SpringBootDemoAdminServerApplication.java | 27 ++++ .../src/main/resources/application.yml | 7 ++ ...ngBootDemoAdminServerApplicationTests.java | 16 +++ 6 files changed, 258 insertions(+) create mode 100644 spring-boot-demo-admin-server/.gitignore create mode 100644 spring-boot-demo-admin-server/README.md create mode 100644 spring-boot-demo-admin-server/pom.xml create mode 100644 spring-boot-demo-admin-server/src/main/java/com/xkcoding/admin/server/SpringBootDemoAdminServerApplication.java create mode 100644 spring-boot-demo-admin-server/src/main/resources/application.yml create mode 100644 spring-boot-demo-admin-server/src/test/java/com/xkcoding/admin/server/SpringBootDemoAdminServerApplicationTests.java diff --git a/spring-boot-demo-admin-server/.gitignore b/spring-boot-demo-admin-server/.gitignore new file mode 100644 index 0000000..82eca33 --- /dev/null +++ b/spring-boot-demo-admin-server/.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-admin-server/README.md b/spring-boot-demo-admin-server/README.md new file mode 100644 index 0000000..1fe464c --- /dev/null +++ b/spring-boot-demo-admin-server/README.md @@ -0,0 +1,115 @@ +# spring-boot-demo-admin-server + +> 本 demo 主要演示了如何搭建一个 Spring Boot Admin 的服务端项目,可视化展示自己客户端项目的运行状态。 + +## pom.xml + +```xml + + + 4.0.0 + + com.xkcoding + spring-boot-demo-admin-server + 0.0.1-SNAPSHOT + jar + + spring-boot-demo-admin-server + Demo project for Spring Boot + + + org.springframework.boot + spring-boot-starter-parent + 2.0.5.RELEASE + + + + + 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 new file mode 100644 index 0000000..fde587f --- /dev/null +++ b/spring-boot-demo-admin-server/pom.xml @@ -0,0 +1,68 @@ + + + 4.0.0 + + com.xkcoding + spring-boot-demo-admin-server + 0.0.1-SNAPSHOT + jar + + spring-boot-demo-admin-server + Demo project for Spring Boot + + + org.springframework.boot + spring-boot-starter-parent + 2.0.5.RELEASE + + + + + 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 + + + + + diff --git a/spring-boot-demo-admin-server/src/main/java/com/xkcoding/admin/server/SpringBootDemoAdminServerApplication.java b/spring-boot-demo-admin-server/src/main/java/com/xkcoding/admin/server/SpringBootDemoAdminServerApplication.java new file mode 100644 index 0000000..1e2b8fb --- /dev/null +++ b/spring-boot-demo-admin-server/src/main/java/com/xkcoding/admin/server/SpringBootDemoAdminServerApplication.java @@ -0,0 +1,27 @@ +package com.xkcoding.admin.server; + +import de.codecentric.boot.admin.server.config.EnableAdminServer; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +/** + *

+ * 启动类 + *

+ * + * @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); + } +} diff --git a/spring-boot-demo-admin-server/src/main/resources/application.yml b/spring-boot-demo-admin-server/src/main/resources/application.yml new file mode 100644 index 0000000..93195d1 --- /dev/null +++ b/spring-boot-demo-admin-server/src/main/resources/application.yml @@ -0,0 +1,7 @@ +server: + port: 8000 +spring: + boot: + admin: + # 管控台上下文路径 + context-path: /admin \ No newline at end of file diff --git a/spring-boot-demo-admin-server/src/test/java/com/xkcoding/admin/server/SpringBootDemoAdminServerApplicationTests.java b/spring-boot-demo-admin-server/src/test/java/com/xkcoding/admin/server/SpringBootDemoAdminServerApplicationTests.java new file mode 100644 index 0000000..b3df7ee --- /dev/null +++ b/spring-boot-demo-admin-server/src/test/java/com/xkcoding/admin/server/SpringBootDemoAdminServerApplicationTests.java @@ -0,0 +1,16 @@ +package com.xkcoding.admin.server; + +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 SpringBootDemoAdminServerApplicationTests { + + @Test + public void contextLoads() { + } + +}