Spring Boot projects may encounter classes in the DAO layer that cannot be injected, as indicated below
Field XXXXXpository in required a bean of type that could not be found.
The injection point has the following annotations:
- @org.springframework.beans.factory.annotation.Autowired(required=true)
My solution for my project is to add @ComponentScan(basePackages = {” package name “}) to the startup class. This annotation allows the application to scan the configuration under dao at a specified location. The package name should be written to the package containing mapper, starting from the first package in the Java file. Such as: com. Example. Demo2. Dao
Read More:
- Start error: field xmapper in com.xxx.service . impl.xxxServiceImpl required a bean of type
- Field xxxMapper in com.xxx.service.impl.xxxServiceImpl
- Springboot project startup exception – required a single bean, but 2 were found
- @Autowired injection * * required a single bean, but 2 were found**
- About starting the service, you always get stuck in com. Alibaba. Druid. Pool. Druiddatasource | {datasource-1} initiated
- On the usage of ‘ref.stor.type search’ field in SAP WM movement type
- No qualifying bean of type ‘javax.sql.DataSource‘ available: expected at least 1
- How to Fix SQL Error: 1054, SQLState: 42S22 Unknown column ‘markcardex0_.art_service_time’ in ‘field list’
- Code signing is required for product type ‘application’ in SDK ‘IOS 10.3’
- fatal: unable to access ‘https://github.com/xxx‘: Failed to connect to github.com
- shiro Error org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type
- Exception in thread “main“ java.lang.ClassCastException: com.sun.proxy.$Proxy8 cannot be cast to XXX
- How to Fix The error may exist in com/kuang/dao/UserMapper.xml
- Mybatis integrates Oracle query and reports an error in the datetime type field
- Push failed Unable to access ‘https://github.com/‘: Failed to connect to github.com port 443: Timed
- Loading class `com.mysql.jdbc.Driver‘. This is deprecated. The new driver class is `com.mysql.cj.jdb
- Solution to the error code of 0x80040154 in COM / ole call
- Property or field ‘Title‘ cannot be found on object of type
- To solve the problem of C # calling excel interface error, prompt: the COM object of Microsoft. Office. Interop. Excel. Applicationclass is forcibly converted to the interface type “Microsoft. Offi”
- [Solved] org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.zyh.springboot.