Description:
Field userMapper in com.haitao.service.impl.UserServiceImpl required a bean of type ‘com.haitao.mapper.UserMapperChan’ 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.haitao.mapper.UserMapperChan’ in your configuration.
解决方法
在启动类上添加 @mapperScan注解
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;
@SpringBootApplication
@MapperScan(basePackages = “com.haitao.mapper”)
public class EmployeeManagerSystemBackApplication {
public static void main(String[] args) {
SpringApplication.run(EmployeeManagerSystemBackApplication.class, args);
}
}