整合junit与热部署

整合junit

复制代码
<dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <version>2.7.0</version>
        </dependency>

测试类上添加@SpringBootTest

如:

注意测试类的目录与主启动类的目录一致,测试方法中添加@Test

热部署(idea)

1、添加spring-boot-devtools热部署启动器

复制代码
<dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <scope>runtime</scope>
        </dependency>

2、file-settings-compiler-勾选Build project automatically

3、ctrl+shift+alt+/ 打开Maintenance中registry,选中...when.app.running

相关推荐
viskaz27 分钟前
数据库迁移流程学习
数据库
auspicious航1 小时前
PostgreSQL写入慢全攻略:原因排查与性能调优实战
数据库·postgresql
IvorySQL1 小时前
PostgreSQL 日报|逻辑复制行过滤致数据丢失(8 月 21 日)
数据库·postgresql
重生之我是Java开发战士2 小时前
【Java EE】事务与事务的传播机制
数据库·java-ee
润乾软件2 小时前
Trae+SQLazy 编写复杂 SQL 实践
数据库·sql
会编程的吕洞宾2 小时前
Redis大Key拖垮线上?排查定位与治理实战
数据库·redis·bootstrap
ltl2 小时前
WiredTiger History Store:文档库里的第三种 MVCC
数据库
码农阿豪2 小时前
若依启动突然报 Redis MISCONF?一次从应用报错到磁盘爆满的完整排查记录
数据库·redis·bootstrap
ltl2 小时前
SQLite 查询计划器:没有 ANALYZE 时靠什么猜
数据库
ltl3 小时前
Redis maxmemory 策略:近似 LRU/LFU 与 MEMORY DOCTOR
数据库