对比
以前使用junit4
现在,springboot 2.4 自动使用junit5
没学springboot
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(“classpath*:spring/applicationContext-*.xml”)
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("classpath*:spring/applicationContext-*.xml")
class Demo02junitApplicationTests {
//查询所有的Person
@Autowired
private IPersonService service;
@Test
void contextLoads() {
service.savePerson();
}
}
springboot 2.4 自动使用junit5
@SpringBootTest
@SpringBootTest
class Demo02junitApplicationTests {
//查询所有的Person
@Autowired
private IPersonService service;
@Test
void contextLoads() {
service.savePerson();
}
}