分享

玩转springboot2.x之搭建Actuator和spring boot admin监控篇

 oldzhoua 2019-04-03

优秀文章,第一时间收到!

文章已获得原作者授权,原文地址:

https://zhuoqianmingyue.blog.csdn.net/article/details/82785269

1、搭建SpringBoot admin 服务端

创建springBoot 项目并引入springBoot admin 服务端的依赖:

<dependency>
    <groupId>de.codecentric</groupId>
    <artifactId>spring-boot-admin-server</artifactId>
    <version>2.0.2</version>
</dependency>
<dependency>
    <groupId>de.codecentric</groupId>
    <artifactId>spring-boot-admin-server-ui</artifactId>
    <version>2.0.2</version>
</dependency>

在SpringBoot 启动类出声明 服务端注解 @EnableAdminServer

import de.codecentric.boot.admin.server.config.EnableAdminServer;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
@EnableAdminServer
public class MonitorserviceApplication {

    public static void main(String[] args) {
        SpringApplication.run(MonitorserviceApplication.class, args);
    }
}

配置服务端的端口:

server.port=8000


2、搭建 SpringBoot amdin 客户端

创建springBoot 项目并引入客户端的依赖:

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-test</artifactId>
    <scope>test</scope>
</dependency>
<dependency>
    <groupId>de.codecentric</groupId>
    <artifactId>spring-boot-admin-starter-client</artifactId>
    <version>2.0.2</version>
</dependency>

配置application.properties

swagger.enable=true
server.servlet.context-path=/learn
server.port=8090

spring.boot.admin.client.url=http://localhost:8000
management.endpoint.health.show-details=always
management.endpoints.web.exposure.include=*
logging.file=E:/IntellJ IDEA/logging/info.2018-09-23.log

3、进行测试

分别启动服务端和客户端: 

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多