1. pom 加入依赖
<!-- spring-boot-admin 监控中心 --> <dependency> <groupId>de.codecentric</groupId> <artifactId>spring-boot-admin-starter-server</artifactId> <version>${spring-boot-admin.version}</version> </dependency> <dependency> <groupId>de.codecentric</groupId> <artifactId>spring-boot-admin-server-ui</artifactId> <version>${spring-boot-admin-ui.version}</version> </dependency> <dependency> <groupId>org.jolokia</groupId> <artifactId>jolokia-core</artifactId> </dependency>
2. application.properties 配置文件
#开启安全认证 用户名和密码 spring.security.user.name=admin spring.security.user.password=root spring.security.basic.enabled=true #actuator配置 management.endpoints.web.exposure.include=* management.endpoints.web.exposure.exclude=env,beans management.security.enabled=false spring.boot.admin.routes.endpoints=env,metrics,trace,dump,jolokia,info,configprops,trace,logfile,refresh,flyway,liquibase,heapdump,activiti,hystrix.stream,turbine.stream
3. 启动类 MainApplication.java
package org.fh; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.netflix.eureka.EnableEurekaClient; import de.codecentric.boot.admin.server.config.EnableAdminServer; /** * 说明:启动类 * www.fhadmin.org */ @SpringBootApplication @EnableEurekaClient @EnableAdminServer public class MainApplication { public static void main(String[] args) { SpringApplication.run(FHmainApplication.class, args); } }
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。