博客详情

springboot 2.7.2 的springbootTest (原创)

作者: 朝如青丝暮成雪
发布时间:2024-08-30 10:32:46  文章分类:java编程   阅读(188)  评论(0)
项目采用springboot2.7.2  ,springcloud版本: 2021.0.4 ,springcloud-alibaba版本: 2021.0.4.0

在springboot2.7体系中,junit是默认采用5的版本。 测试类的写法与之前早期的springboot版本不同!


1、pom.xml引入

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



2、springboot的测试类


import org.springframework.boot.test.context.SpringBootTest;

@SpringBootTest(classes = MyCloudServerApplication.class) //classes传springboot的启动类
public class MybatisPlusTest01 {



    @Test
    public void test1(){
    
    }

}

关键字:  springboot  test
评论信息
暂无评论
发表评论

亲,您还没有登陆,暂不能评论哦! 去 登陆 | 注册

博主信息
   
数据加载中,请稍候...
文章分类
   
数据加载中,请稍候...
阅读排行
 
数据加载中,请稍候...
评论排行
 
数据加载中,请稍候...

Copyright © 叮叮声的奶酪 版权所有
备案号:鄂ICP备17018671号-1

鄂公网安备 42011102000739号