1.pom.xml
<dependencies>
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-server</artifactId>
<version>1.5.6</version>
</dependency>
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-server-ui</artifactId>
<version>1.5.6</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-mail</artifactId>
<version>1.5.9.RELEASE</version>
</dependency>
</dependencies>@Configuration
@EnableAutoConfiguration
@EnableAdminServer
public class SpringBootAdminApplication {
public static void main(String[] args) {
SpringApplication.run(SpringBootAdminApplication.class, args);
}
}
2.启动类
@Configuration
@EnableAutoConfiguration
@EnableAdminServer
public class SpringBootAdminApplication {
public static void main(String[] args) {
SpringApplication.run(SpringBootAdminApplication.class, args);
}
}
3.配置文件
server:
port: 9999
spring:
application:
name: service-admin
mail:
host: smtp.163.com
username: aaronrao2018@163.com
password: 2018shijiebei
properties:
mail.debug: false
mail.smtp.auth: true
boot:
admin:
notify:
mail:
to: 3376224996@qq.com
from: aaronrao2018@163.com
# ignore-changes: UNKNOWN:UP
routes:
endpoints: env,metrics,dump,jolokia,info,configprops,trace,
logfile,refresh,flyway,liquibase,heapdump,loggers,auditevents,hystrix.stream