springboot启动报错:"Error starting ApplicationContext. To display the conditions report re-run your appl

Spring Boot启动时,报错如下:

***************************
APPLICATION FAILED TO START
***************************

Description:

Field deviceMapper in com.esagent.es.EsDataInit required a bean of type 'com.esagent.mapper.EmDeviceMapper' 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.esagent.mapper.EmDeviceMapper' in your configuration.

网上提到的解决办法大概有以下几种

  1. Application启动类包位置不对
  2. 启动类未配置MapperScan
  3. Mapper未配置注解@Mapper
  4. yml文件未配置mybatis相关

我的话是第一种情况,所有注释为 Bean 的类都必须和 Application 启动类在同一目录下或者在 Application 启动类同级子目录下
下面的 test 目录和 test 目录下的文件不在 tata 目录下,会报错
springboot启动报错:

你可能感兴趣的:(Spring,Boot)