整合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