The injection point has the following annotations: - @org.springframework.beans.factory.annotation.Autowired(required=true)
作者: java 发布时间: 2022-11-23 浏览: 2569 次 编辑Java报错:
The injection point has the following annotations:
- @org.springframework.beans.factory.annotation.Autowired(required=true)
Action:
Consider defining a bean of type 'com.smartpension.mapper.CommodityCategoryMapper' in your configuration.
错误原因:Autowired 根据类型去spring容器找,找不到那个类,就会报错。
解决方法:在springboot启动类上添加注解 @MapperScan(basePackages),引号里面代表dao方法
/** * 启动程序 */ @SpringBootApplication @EnableAspectJAutoProxy @EnableAsync @EnableTransactionManagement @EnableScheduling @MapperScan("com.smartpension.mapper") public class SmartPensionServiceApplication { public static void main(String[] args) { SpringApplication.run(SmartPensionServiceApplication.class, args); } }
标签: