springcloud 整合 springboot-admin 监控中心 代码片段
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=adminspring.security.user.password=rootspring.security.basic.enabled=true#actuator配置management.endpoints.web.exposure.include=*management.endpoints.web.exposure.exclude=env,beansmanagement.security.enabled=falsespring.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@EnableAdminServerpublic class MainApplication {public static void main(String[] args) {SpringApplication.run(FHmainApplication.class, args);}}
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。