?Micrometer
支持多种监控系统
?一些核心度量指标
?SpringBoot 2.0.X? 特性
?
?SpringBoot Admin
Spring Boot Admin 目的 ????????·为Spring Boot应用程序提供一套管理界面 主要功能 ????????·集中展示应用程序Actuator相关的内容 ????????·变更通知
?
?
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<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>
?
@SpringBootApplication
@EnableAdminServer
public class SbaServerApplication extends WebSecurityConfigurerAdapter {
@Autowired
private AdminServerProperties adminServerProperties;
public static void main(String[] args) {
SpringApplication.run(SbaServerApplication.class, args);
}
@Override
protected void configure(HttpSecurity http) throws Exception {
String adminContextPath = adminServerProperties.getContextPath();
SavedRequestAwareAuthenticationSuccessHandler successHandler = new SavedRequestAwareAuthenticationSuccessHandler();
successHandler.setTargetUrlParameter("redirectTo");
successHandler.setDefaultTargetUrl(adminContextPath + "/");
http.authorizeRequests()
.antMatchers(adminContextPath + "/assets/**").permitAll()
.antMatchers(adminContextPath + "/login").permitAll()
.anyRequest().authenticated()
.and()
.formLogin().loginPage(adminContextPath + "/login").successHandler(successHandler).and()
.logout().logoutUrl(adminContextPath + "/logout").and()
.httpBasic().and()
.csrf()
.csrfTokenRepository(CookieCsrfTokenRepository.withHttpOnlyFalse())
.ignoringAntMatchers(
adminContextPath + "/instances",
adminContextPath + "/actuator/**"
);
}
}
配置
spring.application.name=sba-server server.port=8080
spring.security.user.name=geektime spring.security.user.password=sba-server-password
客户端配置
spring.application.name=sba-client server.port=8081
management.endpoints.web.exposure.include=*
info.demo.name=Spring Boot Admin Client Demo
spring.security.user.name=geektime spring.security.user.password=sba-client-password
spring.boot.admin.client.url=http://localhost:8080 spring.boot.admin.client.username=geektime spring.boot.admin.client.password=sba-server-password
spring.boot.admin.client.instance.metadata.user.name=${spring.security.user.name} spring.boot.admin.client.instance.metadata.user.password=${spring.security.user.password}
?
依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</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-web</artifactId>
</dependency>
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-starter-client</artifactId>
</dependency>
?
|