1. Problem: An error occurs when starting Tomcat!
The main error codes are as follows
No qualifying bean of type [com.*.*.*.*.*.dao.InfoDao] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@javax.annotation.Resource(shareable=true, mappedName=, description=, name=, type=class java.lang.Object, authenticationType=CONTAINER)}
1
WARN o.s.w.c.s.XmlWebApplicationContext - Exception encountered during context initialization - cancelling refresh attempt
Note: There is no problem with my annotation path, but an error still occurs.
4. The reason for my error: I created a multi-level directory in the project directory, and
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
Note: (1) Find the bean label. The initial setting is only the first one. Two, and my solution is to add the content in the blue box at the end to solve the above problem. (2) As mentioned in the "Note" in point 3 above: My error was not caused by the annotation path, but because the automatic scanning directory set in the configuration file was level 2, and I wanted The running code is a level 3 directory, so an additional level is required.
(3) Based on most of the causes of this error on the Internet, I think it is mainly to make modifications in the configuration file (mine is applicationContext.xml), pay special attention to
This basically occurs The errors are all xml file mapping path errors, check whether the path is correct
This article is not original and was obtained from Baidu when encountering problems. It was indeed found that the mapping path is wrong. I also tested other paths and this error was always reported
The above is the detailed content of No qualifying bean of typefound for: error occurs. For more information, please follow other related articles on the PHP Chinese website!