Title

SpringBootTest

引入依赖

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(){

    }

}
posted @ 2024-01-30 11:19  Jackpot_ABC  阅读(21)  评论(0)    收藏  举报