SpringBoot Admin的基本使用(单体应用)

SpringBoot Admin的基本使用(单体应用)springboot 项目和 springbootad 项目不建议放在一起 因为目的是为了监控 如果放在一起的话 一旦 springboot 挂了 springbootad 也就一起挂了

  • springboot项目和springboot admin项目不建议放在一起,因为目的是为了监控,如果放在一起的话,一旦springboot挂了,springboot admin也就一起挂了,监控就失去意义.
  • 搭建监控项目: 注意版本号要springboot版本号一致.
     
         
          
          
            org.springframework.boot 
           
          
            spring-boot-starter-web 
           
          
          
          
            de.codecentric 
           
          
            spring-boot-admin-starter-server 
           
          
            2.4.1 
           
          
        
    @SpringBootApplication @EnableAdminServer public class MindsaApplication { public static void main(String[] args) { SpringApplication.run(MindsaApplication.class, args); } }

    启动类上加注解EnableAdminServer

    server: port: 8000 

    配置端口8000

  • 配置要监控的服务
     
         
         
           de.codecentric 
          
         
           spring-boot-admin-starter-client 
          
         
           2.4.1 
          
        

    版本号要一致

    spring: application: name: jingxihua-inner # 服务名称 boot: admin: client: url: http://localhost:8000 #监控中心地址 instance: prefer-ip: true #以IP的形式展示服务列表 # 如果配置了server.servlet.context-path,则改地址也要加上 service-url: http://localhost:8088 #监控服务地址(当前服务的地址) server: port: 8088 management: endpoints: web: exposure: include: "*" endpoint: health: show-details: always logging: file: name: jingxihua-inner.log 

     

 

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/214005.html原文链接:https://javaforall.net

(0)
上一篇 2026年3月18日 下午5:12
下一篇 2026年3月18日 下午5:12


相关推荐

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号