使用IntelliJ IDEA 2018.2.5 x64版本idea创建spring boot项目会直接创建好一个test测试样例
@RunWith(SpringRunner.class)
@SpringBootTest
public class ServiceApplicationTests {
@Test
public void contextLoads() {
}
}
但是如果没有其他配置,仅仅是测试一下会报一下错误
需要添加注解(转自:https://www.cnblogs.com/shifu8005/p/9873271.html)
@EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class})
则启动成功