首页 > 其他分享 >SpringBoot Admin的基本使用(单体应用)

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

时间:2023-06-05 14:34:44浏览次数:35  
标签:SpringBoot Admin spring boot 单体 版本号 admin 监控 springboot


  • springboot项目和springboot admin项目不建议放在一起,因为目的是为了监控,如果放在一起的话,一旦springboot挂了,springboot admin也就一起挂了,监控就失去意义.
  • 搭建监控项目:
<dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>de.codecentric</groupId>
            <artifactId>spring-boot-admin-starter-server</artifactId>
            <version>2.4.1</version>
        </dependency>

注意版本号要springboot版本号一致.

@SpringBootApplication
@EnableAdminServer
public class MindsaApplication {

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

}

启动类上加注解EnableAdminServer

server:
  port: 8000

配置端口8000

  • 配置要监控的服务
<dependency>
            <groupId>de.codecentric</groupId>
            <artifactId>spring-boot-admin-starter-client</artifactId>
            <version>2.4.1</version>
        </dependency>

版本号要一致

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

 

标签:SpringBoot,Admin,spring,boot,单体,版本号,admin,监控,springboot
From: https://blog.51cto.com/u_14121041/6415440

相关文章

  • SpringBoot2.x跨域问题(CrossOrigin失效问题)
    方法一SpringBoot版本的不同,CrossOrigin失效了,正确配置如下:@CrossOrigin(originPatterns="*",allowCredentials="true",maxAge=3600)方法二如果以上方法还是不生效,最后的终极方法可以进行硬编码进行跨域设置:对需要跨域的接口,进行Response对象设置可跨域URL设置(*代表......
  • kettle web springboot mvn dockerfile
    远程构建dcokerfileFROMopenjdk:8-jdk-alpineasTEMP_BUILD_IMAGERUNset-eux&&sed-i's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g'/etc/apk/repositoriesRUNapkupdate&&\apkadd--no-cachebashcurlwget&&......
  • SpringBoot2 缓存之王caffeine
    <dependency><groupId>com.github.ben-manes.caffeine</groupId><artifactId>caffeine</artifactId><version>2.9.0</version></dependency>顺便写了个工具类配合SpringBoot使用:packag......
  • SpringBoot配置多个RabbitMq
    YMLrabbitmq:first:username:${app.appkey}password:${app.appkey}virtual-host:${app.appid}addresses:x.x.x.x:5672,x.x.x.x:5672#集群second:username:guestpassword:guestvirtual-host:/host:......
  • springboot 项目打war包
    修改主类,参照以下格式EducationErverApplication.class@SpringBootApplication//war包启动类publicclassEducationErverApplicationextendsSpringBootServletInitializer{publicstaticvoidmain(String[]args){SpringApplication.run(EducationErve......
  • springboot 发送邮箱验证码
    0步骤总览开启邮箱的POP3/SMTP服务。新建springboot项目。导入依赖。配置配置文件。编写controller测试接口。postman中测试1开启邮箱的POP3/SMTP服务这里我用的网易邮箱,其它邮箱类似步骤,不清楚的可以百度。总之就是要打开pop3/smtp服务,如果按照我的方法......
  • springboot集成Knife4j
    1.springboot我用的2.7.X引入maven<!--整合Knife4j--><dependency><groupId>com.github.xiaoymin</groupId><artifactId>knife4j-spring-boot-starter</artifactId><version>3.0.3</version></dependency>......
  • SpringBoot中的定时任务的同步与异步
    SpringBoot中的定时任务的同步与异步你确定真的知道?授人以渔Java领域;架构知识;面试心得;互联网行业最新资讯定时任务调度功能在我们的开发中是非常常见的,随便举几个例子:定时清除一些过期的数据,定时发送邮件等等,实现定时任务调度的方式也十分多样,本篇文章主要学习各种实现定时任务......
  • SpringBoot中的MapStruct使用
    目的:MapStruct可以实现对象之间的转换一、引入依赖<!--lombok--><dependency><groupId>org.projectlombok</groupId><artifactId>lombok</artifactId></dependency><!--mapstruct--><dependency><groupId>org.m......
  • fastAdmin 修改表单验证错误提示信息位置
    原先效果: 觉得在右侧不太好看,另外假如布局设置一行两块表单,那么会影响效果。解决方案找到\public\assets\js\require-form.js大概在15行左右//绑定表单事件form.validator($.extend({validClass:'has-success',invalidClass:'has-error',bindClassTo......