稷然如此

  • 首页
  • 文章分类
    • AI
    • Android
    • Java
    • Shell
    • Vue
    • C#
    • Python
    • 数据库
    • 组件
    • 其他
    • Game
  • 常用命令
    • Docker
    • Git
    • Linux
  • 操作系统
    • CentOS
    • Ubuntu
    • Windows
    • Kylin
  • 工具
    • IntelliJ IDEA
    • Visual Studio Code
稷然如此
不积跬步,无以至千里
  1. 首页
  2. 文章分类
  3. Java
  4. 正文

Spring Boot Admin-服务监控

2023年7月11日 874点热度 0人点赞

1.集成akim-cloud-monitor

2.网关引用依赖

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

<dependency>
	<groupId>de.codecentric</groupId>
	<artifactId>spring-boot-admin-starter-server</artifactId> <!-- 实现 Spring Boot Admin Server 服务端 -->
</dependency>

3.网关启动Application添加注解

@EnableAdminServer
例:
@SpringBootApplication
@EnableAdminServer
public class GatewayServerApplication {
	public static void main(String[] args) {
		SpringApplication.run(GatewayServerApplication.class, args);
	}
}

4.增加application.yaml配置

这里需要看profiles使用的是什么环境,这里使用的local,所以配置文件为application-local.yaml,如果不配置,则会与swagger冲突,导致通过网关访问swagger报404,主要是更改管理上下文(https://cloud.tencent.com/developer/ask/sof/1573870):
spring:
  boot:
	admin:
	  client:
		url: http://127.0.0.1:${server.port}/${spring.boot.admin.context-path} # 设置 Spring Boot Admin Server 地址
		instance:
		  service-host-type: IP
	  context-path: /admin

4.访问网关地址

例:http://localhost:8080
标签: Spring Boot Spring Boot Admin
最后更新:2023年7月11日

Akim

犇 骉 Java、C#、Python、Go、Android、MiniProgram、Bootstrap、Vue2

点赞
< 上一篇
下一篇 >
文章目录
  • 1.集成akim-cloud-monitor
  • 2.网关引用依赖
  • 3.网关启动Application添加注解
  • 4.增加application.yaml配置
  • 4.访问网关地址

Copyright © 2025 aianran.com All Rights Reserved.

免责申明 | 隐私政策 | 服务条款 | 关于我们

黔ICP备2023008200号-1

贵公网安备 52010202003594号