项目场景:Error starting ApplicationContext. To display the conditions report re-run your application with ‘debug’ enabled.问题的解决
问题描述:
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2021-10-02 13:18:49.964 ERROR 7280 --- [ restartedMain] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
APPLICATION FAILED TO START
***************************
Description:
Field navigationMapper in com.test.littleapp.controller.NavigationController required a bean of type 'com.test.littleapp.mapper.NavigationMapper' 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.test.littleapp.mapper.NavigationMapper' in your configuration.
解决方案:
在spring boot Application主文件下加上
@MapperScan("你的mapper包名")
package com.test.littleapp;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
@MapperScan("com.test.littleapp.mapper")
public class LittleappApplication {
public static void main(String[] args) {
SpringApplication.run(LittleappApplication.class, args);
}
}