测试的时候没注意,要有启动类。。。。。

springboot 之 java.lang.IllegalStateException Unable to find a @SpringBootConfiguration错误解决方案

对于2,如果要是写测试类,需要这么写

@RunWith(SpringRunner.class)
@SpringBootTest(classes = DemoApplication.class)

指定启动类

springboot 之 java.lang.IllegalStateException Unable to find a @SpringBootConfiguration错误解决方案  springboot 之 java.lang.IllegalStateException Unable to find a @SpringBootConfiguration错误解决方案

要么就得在test目录下对java目录下的文件结构。

 

相关文章: