添加
@RunWith(SpringJUnit4ClassRunner.class)
注解即可
@SpringBootTest
@RunWith(SpringJUnit4ClassRunner.class)
public class ServiceTest {
@Autowired
UserService userService;
@Test
public void findAll(){
System.out.println(userService.list());
}
}