Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2021-01-04 11:46:10.376 ERROR 1764 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
APPLICATION FAILED TO START
***************************
Description:
Field studentMapper in com.fh.service.impl.StudentServiceImpl required a bean of type 'com.fh.mapper.StudentMapper' 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.fh.mapper.StudentMapper' in your configuration.
Process finished with exit code 1
解决方案1:在mapper包中 xxx接口上加@Mapper注解
@Mapper
public interface StudentMapper {
}
解决方案2:StudentApplication类上加@MapperScan(“xxx.xx.mapper”)注解 xxx.xx.mapper为mapper包路径
@SpringBootApplication
@MapperScan("xxx.xx.mapper")
public class StudentApplication {
public static void main(String[] args) {
SpringApplication.run(StudentApplication.class, args);
}
}