Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled. 2023-08-27 18:18:13.481 ERROR 4816 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter : *************************** APPLICATION FAILED TO START *************************** Description: Field zgrtZdxmDao in com.cetc15.zdxm.service.impl.ZdxmDtXgpjServiceImpl required a bean of type 'com.cetc15.zdxm.dao.ZgrtZdxmDao' that could not be found. The injection point has the following annotations: - @org.springframework.beans.factory.annotation.Autowired(required=true) Action: Consider defining a bean of type 'com.cetc15.zdxm.dao.ZgrtZdxmDao' in your configuration.
报错大概意思就是,无法找到对应的dao接口,经过分析发现,未设置保扫描
解决方案如下:在启动类上加入以下代码即可
@SpringBootApplication @MapperScan(basePackages = "com.cetc15.zdxm.dao")//指定包扫描 public class DemoApplication {