Error starting ApplicationContext. To display the conditions report re-run your application with ‘debug’ enabled. How to Solve
Error Message:
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.
Solution:
Under the main file of spring boot application, add
@MapperScan("Your mapper name")
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);
}
}