搭建springboot admin

1、搭建springboot admin server

 

1.1、pom文件

<properties>
        <!--和springboot-parent版本对应,否则启动报错-->
        <spring-boot-admin.version>2.0.0</spring-boot-admin.version>
</properties>

<dependencies>
        <!-- 该依赖依赖了admin-server和admin-server-ui -->
        <dependency>
            <groupId>de.codecentric</groupId>
            <artifactId>spring-boot-admin-starter-server</artifactId>
        </dependency>

        <!--springboot admin-->
        <!--<dependency>
            <groupId>de.codecentric</groupId>
            <artifactId>spring-boot-admin-server</artifactId>
            <version>2.0.0</version>
        </dependency>

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



</dependencies>

<dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>de.codecentric</groupId>
                <artifactId>spring-boot-admin-dependencies</artifactId>
                <version>${spring-boot-admin.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

1.2、启动类打上@EnableAdminServer注解

 

 

2、搭建springboot admin client

 

2.1、pom文件

<!--引入springboot admin client,该依赖依赖了springboot性能监控 -->
        <dependency>
            <groupId>de.codecentric</groupId>
            <artifactId>spring-boot-admin-starter-client</artifactId>
<!--与springboot-parent版本对应,否则启动报错 -->
            <version>2.0.0</version>
        </dependency>


        <!--springboot性能监控-->
        <!--<dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>-->

 

2.2、application.yml

server:
  port: 8081
spring:
  application:
    name: springboot-swagger2-demo
  boot:
    admin:
      client:
        url: http://localhost:8080

#/health	展示了进程的健康状态
#/beans	程序创建的Bean
#/configprops	配置信息,属性值
#/env	环境属性
#/info	info开头的程序属性信息
#/metrics	度量指标,比如JVM和HTTP请求等
#/trace	HTTP的详细请求信息
#/mappings	所有的URL路径映射关系
#/dump	线程快照信息
#/heapdump	内存快照信息
management:
  endpoints:
    web:
      exposure:
        include: '*'
  endpoint:
    health:
      #enabled: false #关闭某个接口
      show-details: always

 

3、启动项目,访问locahost:8080

搭建springboot admin

上一篇:【算法进阶】用模拟退火(SA, Simulated Annealing)算法解决旅行商问题


下一篇:网络安全top国际会议