1.系统监控使用springboot admin
2.springboot admin server
2.1 修改pom.xml增加dependency
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-server</artifactId>
<version>1.3.2</version>
</dependency>
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-server-ui</artifactId>
<version>1.3.2</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
2.2 启动类SpringbootApplication增加admin注解支持
@SpringBootApplication
@EnableAutoConfiguration
@EnableAdminServer
public class SpringbootApplication {
public static void main(String[] args) {
SpringApplication.run(SpringbootApplication.class, args);
}
}
2.3 修改属性文件application.properties
server.display-name=springbootserver
server.context-path=/
server.servlet-path=/
server.port=8090
# admin
spring.boot.admin.url=http://localhost:${server.port}
3.springboot admin client
3.1 修改pom.xml增加dependency
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-starter-client</artifactId>
<version>1.3.4</version>
</dependency>
<dependency>
<groupId>org.jolokia</groupId>
<artifactId>jolokia-core</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
3.2 修改属性文件application.properties
server.display-name=springbootserver
server.context-path=/
server.servlet-path=/
server.port=8090
# admin
spring.boot.admin.url=http://localhost:8090
3.3 logback.xml增加配置
<configuration>
<include resource="org/springframework/boot/logging/logback/base.xml"/>
<jmxConfigurator/>
</configuration>
启动server和client即可查看应用的状态
http://localhost:8090