目 录CONTENT

文章目录

springboot下配置junit运行环境

Administrator
2022-10-30 / 0 评论 / 0 点赞 / 1779 阅读 / 1783 字

方式一 通过IDEA配置

打开idea运行配置
在Environment variables:中添加以下环境变量

spring.profiles.active=dev

微信截图_20220928164246.png

方式二 通过注解选择环境

在测试类在添加@ActiveProfiles注解

@SpringBootTest
@RunWith(SpringRunner.class)
@ActiveProfiles("dev")
public class ImageTest {
    @Test
    public void demo(){
        System.out.println("hello wrold");
    }
}

0

评论区