半年没做springboot了忘了怎么测试了,一直空指针
加上两个注释就行了
补充------------------------------------------
使用springbootTest只需要导入依赖,spring boot Test 的启动器
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
</dependency>
然后测试类 头上加注释@Spring Boot Test
然后测试方法加上@Test注解
需要注意的是这两个包,我之前一直导成junit.test然后一直空指针