0
点赞
收藏
分享

微信扫一扫

springboot-test配置

树下的老石头 2022-03-30 阅读 78
java后端

springboot-test配置

文章目录

1.依赖配置

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
            <!--<scope>test</scope>-->
        </dependency>

2. 测试类

测试类上的注解

@RunWith(SpringRunner.class)
@SpringBootTest

3.注意

测试类需要使用public修饰,测试类中需要启动的方法也需要使用public修饰。

备注

参考地址:https://www.jianshu.com/p/53da42731e69

举报

相关推荐

0 条评论