首页 > 其他分享 >SpringBootTest

SpringBootTest

时间:2024-01-30 11:35:35浏览次数:38  
标签:boot junit class SpringBootTest test public

引入依赖

pom 文件中添加以下依赖

<dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
</dependencies>
<properties>
        <skipTests>true</skipTests>
</properties>

建立测试类

@SpringBootTest(classes = GisBootApplication.class)//启动类
@RunWith(SpringRunner.class)
public class UserTest {

    @Resource
    private UserService userService;

    @Test
    public void main(){

    }

}

标签:boot,junit,class,SpringBootTest,test,public
From: https://www.cnblogs.com/congshaoblog/p/17996737

相关文章