springBoot 2.0以上 热部署与系统监管测试

springBoot实现热部署:

一、引入依赖

只需要在pom中加入(springBoot官网(https://docs.spring.io/spring-boot/docs/2.1.9.RELEASE/reference/html/using-boot-build-systems.html#using-boot-maven)找devtool依赖):spring-boot-devtools

<dependency>
     <groupId>org.springframework.boot</groupId>
     <artifactId>spring-boot-devtools</artifactId>
     <scope>runtime</scope>
</dependency>

二、在修改完文件后要build项目(IDEA中),一般快捷键为Ctrl+F9

--------------------------------------------------------------------------------------------------------------------------------------------------

springboot项目使用actuator配置监控点测试:

一、引入依赖

<!-- 引入Actuator监控依赖 -->
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-actuator</artifactId>
		</dependency>

二、在配置文件中添加

### 1.5版本的添加下面的配置
management:
    security: 
    enabled: false

### 2.0版本只有的就没有了Security内部类了,需要以下设置
方式一:
# 启用单个端点 env
management:
  endpoint:
    env:
      enabled: true
  # 暴露端点 env 配置多个,隔开.
  endpoints:
    web:
      exposure:
        include: env
方式二:
# 启用所有端点
management:
  endpoints:
    web:
      exposure:
        include: '*'

    注意:若在核心配置文件中未添加 management.security.enabled=false 配置,将会导致用户在访问部分监控地址时访问受限,报401未授权错误。

下图取自于其他博客:

至于详细引用查看博客:https://blog.youkuaiyun.com/pengjunlee/article/details/80235390

,如果你加入了Spring Security ,在没有配置用户名密码的情况下,它会有默认的用户名密码:

默认用户名:user

默认密码会在你的控制台有打印(如图,类似红色框中就是你自己的默认密码):

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值