| @@ -11,8 +11,7 @@ | |||
| <module>spring-boot-demo-helloworld</module> | |||
| <module>spring-boot-demo-properties</module> | |||
| <module>spring-boot-demo-actuator</module> | |||
| <module>spring-boot-demo-admin-client</module> | |||
| <module>spring-boot-demo-admin-server</module> | |||
| <module>spring-boot-demo-admin</module> | |||
| <module>spring-boot-demo-logback</module> | |||
| <module>spring-boot-demo-log-aop</module> | |||
| <module>spring-boot-demo-exception-handler</module> | |||
| @@ -163,4 +162,4 @@ | |||
| </plugins> | |||
| </pluginManagement> | |||
| </build> | |||
| </project> | |||
| </project> | |||
| @@ -1,117 +0,0 @@ | |||
| # spring-boot-demo-admin-client | |||
| > 本 demo 主要演示了普通项目如何集成 Spring Boot Admin,并把自己的运行状态交给 Spring Boot Admin 进行展现。 | |||
| ## pom.xml | |||
| ```xml | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |||
| xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |||
| <modelVersion>4.0.0</modelVersion> | |||
| <artifactId>spring-boot-demo-admin-client</artifactId> | |||
| <version>1.0.0-SNAPSHOT</version> | |||
| <packaging>jar</packaging> | |||
| <name>spring-boot-demo-admin-client</name> | |||
| <description>Demo project for Spring Boot</description> | |||
| <parent> | |||
| <groupId>com.xkcoding</groupId> | |||
| <artifactId>spring-boot-demo</artifactId> | |||
| <version>1.0.0-SNAPSHOT</version> | |||
| </parent> | |||
| <properties> | |||
| <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | |||
| <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> | |||
| <java.version>1.8</java.version> | |||
| <spring-boot-admin.version>2.0.3</spring-boot-admin.version> | |||
| </properties> | |||
| <dependencies> | |||
| <dependency> | |||
| <groupId>org.springframework.boot</groupId> | |||
| <artifactId>spring-boot-starter-web</artifactId> | |||
| </dependency> | |||
| <dependency> | |||
| <groupId>de.codecentric</groupId> | |||
| <artifactId>spring-boot-admin-starter-client</artifactId> | |||
| </dependency> | |||
| <dependency> | |||
| <groupId>org.springframework.boot</groupId> | |||
| <artifactId>spring-boot-starter-security</artifactId> | |||
| </dependency> | |||
| <dependency> | |||
| <groupId>org.springframework.boot</groupId> | |||
| <artifactId>spring-boot-starter-test</artifactId> | |||
| <scope>test</scope> | |||
| </dependency> | |||
| </dependencies> | |||
| <dependencyManagement> | |||
| <dependencies> | |||
| <dependency> | |||
| <groupId>de.codecentric</groupId> | |||
| <artifactId>spring-boot-admin-dependencies</artifactId> | |||
| <version>${spring-boot-admin.version}</version> | |||
| <type>pom</type> | |||
| <scope>import</scope> | |||
| </dependency> | |||
| </dependencies> | |||
| </dependencyManagement> | |||
| <build> | |||
| <finalName>spring-boot-demo-admin-client</finalName> | |||
| <plugins> | |||
| <plugin> | |||
| <groupId>org.springframework.boot</groupId> | |||
| <artifactId>spring-boot-maven-plugin</artifactId> | |||
| </plugin> | |||
| </plugins> | |||
| </build> | |||
| </project> | |||
| ``` | |||
| ## 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: "*" | |||
| ``` | |||
| @@ -1,71 +0,0 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |||
| xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |||
| <modelVersion>4.0.0</modelVersion> | |||
| <artifactId>spring-boot-demo-admin-client</artifactId> | |||
| <version>1.0.0-SNAPSHOT</version> | |||
| <packaging>jar</packaging> | |||
| <name>spring-boot-demo-admin-client</name> | |||
| <description>Demo project for Spring Boot</description> | |||
| <parent> | |||
| <groupId>com.xkcoding</groupId> | |||
| <artifactId>spring-boot-demo</artifactId> | |||
| <version>1.0.0-SNAPSHOT</version> | |||
| </parent> | |||
| <properties> | |||
| <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | |||
| <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> | |||
| <java.version>1.8</java.version> | |||
| <spring-boot-admin.version>2.1.0</spring-boot-admin.version> | |||
| </properties> | |||
| <dependencies> | |||
| <dependency> | |||
| <groupId>org.springframework.boot</groupId> | |||
| <artifactId>spring-boot-starter-web</artifactId> | |||
| </dependency> | |||
| <dependency> | |||
| <groupId>de.codecentric</groupId> | |||
| <artifactId>spring-boot-admin-starter-client</artifactId> | |||
| </dependency> | |||
| <dependency> | |||
| <groupId>org.springframework.boot</groupId> | |||
| <artifactId>spring-boot-starter-security</artifactId> | |||
| </dependency> | |||
| <dependency> | |||
| <groupId>org.springframework.boot</groupId> | |||
| <artifactId>spring-boot-starter-test</artifactId> | |||
| <scope>test</scope> | |||
| </dependency> | |||
| </dependencies> | |||
| <dependencyManagement> | |||
| <dependencies> | |||
| <dependency> | |||
| <groupId>de.codecentric</groupId> | |||
| <artifactId>spring-boot-admin-dependencies</artifactId> | |||
| <version>${spring-boot-admin.version}</version> | |||
| <type>pom</type> | |||
| <scope>import</scope> | |||
| </dependency> | |||
| </dependencies> | |||
| </dependencyManagement> | |||
| <build> | |||
| <finalName>spring-boot-demo-admin-client</finalName> | |||
| <plugins> | |||
| <plugin> | |||
| <groupId>org.springframework.boot</groupId> | |||
| <artifactId>spring-boot-maven-plugin</artifactId> | |||
| </plugin> | |||
| </plugins> | |||
| </build> | |||
| </project> | |||
| @@ -1,113 +0,0 @@ | |||
| # spring-boot-demo-admin-server | |||
| > 本 demo 主要演示了如何搭建一个 Spring Boot Admin 的服务端项目,可视化展示自己客户端项目的运行状态。 | |||
| ## pom.xml | |||
| ```xml | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |||
| xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |||
| <modelVersion>4.0.0</modelVersion> | |||
| <artifactId>spring-boot-demo-admin-server</artifactId> | |||
| <version>1.0.0-SNAPSHOT</version> | |||
| <packaging>jar</packaging> | |||
| <name>spring-boot-demo-admin-server</name> | |||
| <description>Demo project for Spring Boot</description> | |||
| <parent> | |||
| <groupId>com.xkcoding</groupId> | |||
| <artifactId>spring-boot-demo</artifactId> | |||
| <version>1.0.0-SNAPSHOT</version> | |||
| </parent> | |||
| <properties> | |||
| <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | |||
| <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> | |||
| <java.version>1.8</java.version> | |||
| <spring-boot-admin.version>2.0.3</spring-boot-admin.version> | |||
| </properties> | |||
| <dependencies> | |||
| <dependency> | |||
| <groupId>org.springframework.boot</groupId> | |||
| <artifactId>spring-boot-starter-web</artifactId> | |||
| </dependency> | |||
| <dependency> | |||
| <groupId>de.codecentric</groupId> | |||
| <artifactId>spring-boot-admin-starter-server</artifactId> | |||
| </dependency> | |||
| <dependency> | |||
| <groupId>org.springframework.boot</groupId> | |||
| <artifactId>spring-boot-starter-test</artifactId> | |||
| <scope>test</scope> | |||
| </dependency> | |||
| </dependencies> | |||
| <dependencyManagement> | |||
| <dependencies> | |||
| <dependency> | |||
| <groupId>de.codecentric</groupId> | |||
| <artifactId>spring-boot-admin-dependencies</artifactId> | |||
| <version>${spring-boot-admin.version}</version> | |||
| <type>pom</type> | |||
| <scope>import</scope> | |||
| </dependency> | |||
| </dependencies> | |||
| </dependencyManagement> | |||
| <build> | |||
| <finalName>spring-boot-demo-admin-server</finalName> | |||
| <plugins> | |||
| <plugin> | |||
| <groupId>org.springframework.boot</groupId> | |||
| <artifactId>spring-boot-maven-plugin</artifactId> | |||
| </plugin> | |||
| </plugins> | |||
| </build> | |||
| </project> | |||
| ``` | |||
| ## SpringBootDemoAdminServerApplication.java | |||
| ```java | |||
| /** | |||
| * <p> | |||
| * 启动类 | |||
| * </p> | |||
| * | |||
| * @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 | |||
| ``` | |||
| @@ -1,66 +0,0 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |||
| xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |||
| <modelVersion>4.0.0</modelVersion> | |||
| <artifactId>spring-boot-demo-admin-server</artifactId> | |||
| <version>1.0.0-SNAPSHOT</version> | |||
| <packaging>jar</packaging> | |||
| <name>spring-boot-demo-admin-server</name> | |||
| <description>Demo project for Spring Boot</description> | |||
| <parent> | |||
| <groupId>com.xkcoding</groupId> | |||
| <artifactId>spring-boot-demo</artifactId> | |||
| <version>1.0.0-SNAPSHOT</version> | |||
| </parent> | |||
| <properties> | |||
| <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | |||
| <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> | |||
| <java.version>1.8</java.version> | |||
| <spring-boot-admin.version>2.1.0</spring-boot-admin.version> | |||
| </properties> | |||
| <dependencies> | |||
| <dependency> | |||
| <groupId>org.springframework.boot</groupId> | |||
| <artifactId>spring-boot-starter-web</artifactId> | |||
| </dependency> | |||
| <dependency> | |||
| <groupId>de.codecentric</groupId> | |||
| <artifactId>spring-boot-admin-starter-server</artifactId> | |||
| </dependency> | |||
| <dependency> | |||
| <groupId>org.springframework.boot</groupId> | |||
| <artifactId>spring-boot-starter-test</artifactId> | |||
| <scope>test</scope> | |||
| </dependency> | |||
| </dependencies> | |||
| <dependencyManagement> | |||
| <dependencies> | |||
| <dependency> | |||
| <groupId>de.codecentric</groupId> | |||
| <artifactId>spring-boot-admin-dependencies</artifactId> | |||
| <version>${spring-boot-admin.version}</version> | |||
| <type>pom</type> | |||
| <scope>import</scope> | |||
| </dependency> | |||
| </dependencies> | |||
| </dependencyManagement> | |||
| <build> | |||
| <finalName>spring-boot-demo-admin-server</finalName> | |||
| <plugins> | |||
| <plugin> | |||
| <groupId>org.springframework.boot</groupId> | |||
| <artifactId>spring-boot-maven-plugin</artifactId> | |||
| </plugin> | |||
| </plugins> | |||
| </build> | |||
| </project> | |||
| @@ -1,9 +0,0 @@ | |||
| server: | |||
| port: 8000 | |||
| servlet: | |||
| context-path: /admin | |||
| spring: | |||
| boot: | |||
| admin: | |||
| # 管控台上下文路径 | |||
| context-path: / | |||
| @@ -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 | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <project xmlns="http://maven.apache.org/POM/4.0.0" | |||
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |||
| xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |||
| <parent> | |||
| <artifactId>spring-boot-demo</artifactId> | |||
| <groupId>com.xkcoding</groupId> | |||
| <version>1.0.0-SNAPSHOT</version> | |||
| </parent> | |||
| <modelVersion>4.0.0</modelVersion> | |||
| <artifactId>spring-boot-demo-admin</artifactId> | |||
| <packaging>pom</packaging> | |||
| <properties> | |||
| <spring-boot-admin.version>2.1.0</spring-boot-admin.version> | |||
| </properties> | |||
| <modules> | |||
| <module>spring-boot-demo-admin-client</module> | |||
| <module>spring-boot-demo-admin-server</module> | |||
| </modules> | |||
| <dependencyManagement> | |||
| <dependencies> | |||
| <dependency> | |||
| <groupId>de.codecentric</groupId> | |||
| <artifactId>spring-boot-admin-dependencies</artifactId> | |||
| <version>${spring-boot-admin.version}</version> | |||
| <type>pom</type> | |||
| <scope>import</scope> | |||
| </dependency> | |||
| </dependencies> | |||
| </dependencyManagement> | |||
| </project> | |||
| ``` | |||
| @@ -0,0 +1,36 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <project xmlns="http://maven.apache.org/POM/4.0.0" | |||
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |||
| xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |||
| <parent> | |||
| <artifactId>spring-boot-demo</artifactId> | |||
| <groupId>com.xkcoding</groupId> | |||
| <version>1.0.0-SNAPSHOT</version> | |||
| </parent> | |||
| <modelVersion>4.0.0</modelVersion> | |||
| <artifactId>spring-boot-demo-admin</artifactId> | |||
| <packaging>pom</packaging> | |||
| <properties> | |||
| <spring-boot-admin.version>2.1.0</spring-boot-admin.version> | |||
| </properties> | |||
| <modules> | |||
| <module>spring-boot-demo-admin-client</module> | |||
| <module>spring-boot-demo-admin-server</module> | |||
| </modules> | |||
| <dependencyManagement> | |||
| <dependencies> | |||
| <dependency> | |||
| <groupId>de.codecentric</groupId> | |||
| <artifactId>spring-boot-admin-dependencies</artifactId> | |||
| <version>${spring-boot-admin.version}</version> | |||
| <type>pom</type> | |||
| <scope>import</scope> | |||
| </dependency> | |||
| </dependencies> | |||
| </dependencyManagement> | |||
| </project> | |||
| @@ -0,0 +1,104 @@ | |||
| # spring-boot-demo-admin-client | |||
| > 本 demo 主要演示了普通项目如何集成 Spring Boot Admin,并把自己的运行状态交给 Spring Boot Admin 进行展现。 | |||
| ## pom.xml | |||
| ```xml | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |||
| xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |||
| <modelVersion>4.0.0</modelVersion> | |||
| <artifactId>spring-boot-demo-admin-client</artifactId> | |||
| <version>1.0.0-SNAPSHOT</version> | |||
| <packaging>jar</packaging> | |||
| <name>spring-boot-demo-admin-client</name> | |||
| <description>Demo project for Spring Boot</description> | |||
| <parent> | |||
| <groupId>com.xkcoding</groupId> | |||
| <artifactId>spring-boot-demo-admin</artifactId> | |||
| <version>1.0.0-SNAPSHOT</version> | |||
| </parent> | |||
| <properties> | |||
| <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | |||
| <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> | |||
| <java.version>1.8</java.version> | |||
| </properties> | |||
| <dependencies> | |||
| <dependency> | |||
| <groupId>org.springframework.boot</groupId> | |||
| <artifactId>spring-boot-starter-web</artifactId> | |||
| </dependency> | |||
| <dependency> | |||
| <groupId>de.codecentric</groupId> | |||
| <artifactId>spring-boot-admin-starter-client</artifactId> | |||
| </dependency> | |||
| <dependency> | |||
| <groupId>org.springframework.boot</groupId> | |||
| <artifactId>spring-boot-starter-security</artifactId> | |||
| </dependency> | |||
| <dependency> | |||
| <groupId>org.springframework.boot</groupId> | |||
| <artifactId>spring-boot-starter-test</artifactId> | |||
| <scope>test</scope> | |||
| </dependency> | |||
| </dependencies> | |||
| <build> | |||
| <finalName>spring-boot-demo-admin-client</finalName> | |||
| <plugins> | |||
| <plugin> | |||
| <groupId>org.springframework.boot</groupId> | |||
| <artifactId>spring-boot-maven-plugin</artifactId> | |||
| </plugin> | |||
| </plugins> | |||
| </build> | |||
| </project> | |||
| ``` | |||
| ## 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: "*" | |||
| ``` | |||
| @@ -0,0 +1,58 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |||
| xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |||
| <modelVersion>4.0.0</modelVersion> | |||
| <artifactId>spring-boot-demo-admin-client</artifactId> | |||
| <version>1.0.0-SNAPSHOT</version> | |||
| <packaging>jar</packaging> | |||
| <name>spring-boot-demo-admin-client</name> | |||
| <description>Demo project for Spring Boot</description> | |||
| <parent> | |||
| <groupId>com.xkcoding</groupId> | |||
| <artifactId>spring-boot-demo-admin</artifactId> | |||
| <version>1.0.0-SNAPSHOT</version> | |||
| </parent> | |||
| <properties> | |||
| <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | |||
| <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> | |||
| <java.version>1.8</java.version> | |||
| </properties> | |||
| <dependencies> | |||
| <dependency> | |||
| <groupId>org.springframework.boot</groupId> | |||
| <artifactId>spring-boot-starter-web</artifactId> | |||
| </dependency> | |||
| <dependency> | |||
| <groupId>de.codecentric</groupId> | |||
| <artifactId>spring-boot-admin-starter-client</artifactId> | |||
| </dependency> | |||
| <dependency> | |||
| <groupId>org.springframework.boot</groupId> | |||
| <artifactId>spring-boot-starter-security</artifactId> | |||
| </dependency> | |||
| <dependency> | |||
| <groupId>org.springframework.boot</groupId> | |||
| <artifactId>spring-boot-starter-test</artifactId> | |||
| <scope>test</scope> | |||
| </dependency> | |||
| </dependencies> | |||
| <build> | |||
| <finalName>spring-boot-demo-admin-client</finalName> | |||
| <plugins> | |||
| <plugin> | |||
| <groupId>org.springframework.boot</groupId> | |||
| <artifactId>spring-boot-maven-plugin</artifactId> | |||
| </plugin> | |||
| </plugins> | |||
| </build> | |||
| </project> | |||
| @@ -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: "*" | |||
| include: "*" | |||
| @@ -0,0 +1,95 @@ | |||
| # spring-boot-demo-admin-server | |||
| > 本 demo 主要演示了如何搭建一个 Spring Boot Admin 的服务端项目,可视化展示自己客户端项目的运行状态。 | |||
| ## pom.xml | |||
| ```xml | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |||
| xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |||
| <modelVersion>4.0.0</modelVersion> | |||
| <artifactId>spring-boot-demo-admin-server</artifactId> | |||
| <version>1.0.0-SNAPSHOT</version> | |||
| <packaging>jar</packaging> | |||
| <name>spring-boot-demo-admin-server</name> | |||
| <description>Demo project for Spring Boot</description> | |||
| <parent> | |||
| <groupId>com.xkcoding</groupId> | |||
| <artifactId>spring-boot-demo-admin</artifactId> | |||
| <version>1.0.0-SNAPSHOT</version> | |||
| </parent> | |||
| <properties> | |||
| <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | |||
| <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> | |||
| <java.version>1.8</java.version> | |||
| </properties> | |||
| <dependencies> | |||
| <dependency> | |||
| <groupId>org.springframework.boot</groupId> | |||
| <artifactId>spring-boot-starter-web</artifactId> | |||
| </dependency> | |||
| <dependency> | |||
| <groupId>de.codecentric</groupId> | |||
| <artifactId>spring-boot-admin-starter-server</artifactId> | |||
| </dependency> | |||
| <dependency> | |||
| <groupId>org.springframework.boot</groupId> | |||
| <artifactId>spring-boot-starter-test</artifactId> | |||
| <scope>test</scope> | |||
| </dependency> | |||
| </dependencies> | |||
| <build> | |||
| <finalName>spring-boot-demo-admin-server</finalName> | |||
| <plugins> | |||
| <plugin> | |||
| <groupId>org.springframework.boot</groupId> | |||
| <artifactId>spring-boot-maven-plugin</artifactId> | |||
| </plugin> | |||
| </plugins> | |||
| </build> | |||
| </project> | |||
| ``` | |||
| ## SpringBootDemoAdminServerApplication.java | |||
| ```java | |||
| /** | |||
| * <p> | |||
| * 启动类 | |||
| * </p> | |||
| * | |||
| * @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 | |||
| ``` | |||
| @@ -0,0 +1,53 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |||
| xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |||
| <modelVersion>4.0.0</modelVersion> | |||
| <artifactId>spring-boot-demo-admin-server</artifactId> | |||
| <version>1.0.0-SNAPSHOT</version> | |||
| <packaging>jar</packaging> | |||
| <name>spring-boot-demo-admin-server</name> | |||
| <description>Demo project for Spring Boot</description> | |||
| <parent> | |||
| <groupId>com.xkcoding</groupId> | |||
| <artifactId>spring-boot-demo-admin</artifactId> | |||
| <version>1.0.0-SNAPSHOT</version> | |||
| </parent> | |||
| <properties> | |||
| <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | |||
| <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> | |||
| <java.version>1.8</java.version> | |||
| </properties> | |||
| <dependencies> | |||
| <dependency> | |||
| <groupId>org.springframework.boot</groupId> | |||
| <artifactId>spring-boot-starter-web</artifactId> | |||
| </dependency> | |||
| <dependency> | |||
| <groupId>de.codecentric</groupId> | |||
| <artifactId>spring-boot-admin-starter-server</artifactId> | |||
| </dependency> | |||
| <dependency> | |||
| <groupId>org.springframework.boot</groupId> | |||
| <artifactId>spring-boot-starter-test</artifactId> | |||
| <scope>test</scope> | |||
| </dependency> | |||
| </dependencies> | |||
| <build> | |||
| <finalName>spring-boot-demo-admin-server</finalName> | |||
| <plugins> | |||
| <plugin> | |||
| <groupId>org.springframework.boot</groupId> | |||
| <artifactId>spring-boot-maven-plugin</artifactId> | |||
| </plugin> | |||
| </plugins> | |||
| </build> | |||
| </project> | |||
| @@ -0,0 +1,2 @@ | |||
| server: | |||
| port: 8000 | |||