Spring boot admin 使用
1. maven依赖
<dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-actuator</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> </dependencies>
2. 应用配置文件
server.port =8090 spring.application.name=SpringBootAdminWeb spring.boot.admin.url=http://localhost:${server.port} spring.jackson.serialization.indent_output=true endpoints.health.sensitive=false
3. spring boot admin server 注解启动
@SpringBootApplication @EnableAdminServer publicclassPaasApplication{ publicstaticvoid main(String[] args){ SpringApplication.run(PaasApplication.class, args); } }
4. 客户端引用
<dependency> <groupId>de.codecentric</groupId> <artifactId>spring-boot-admin-starter-client</artifactId> <version>1.3.2</version> </dependency>
5. 日志操作:
<dependency> <groupId>org.jolokia</groupId> <artifactId>jolokia-core</artifactId> </dependency> <configuration> <include resource="org/springframework/boot/logging/logback/base.xml"/> <jmxConfigurator/> </configuration>
6. 参考文档:
http://codecentric.github.io/spring-boot-admin/1.5.0/#getting-started