IntelliJ idea cancels could not autowire. No beans of ' xxxx ' type found error hint

Source: Internet
Author: User

1. Description of the problem

In the spring project of idea, you often encounter Could not autowire. No beans of ' xxxx ' type found error hint. However, the compilation and operation of the program is not a problem, this error will not have an impact. But the red error hints are somewhat uncomfortable for some obsessive-compulsive programmers.

2. Causes

Spring Auto Scan configuration, in the case of editing, can not find the corresponding bean, and then prompted to find the corresponding bean error. Common in MyBatis Mapper, as follows:

<!--Mapper Scanner Configurer -<BeanID= "Mapperscannerconfig"class= "Org.mybatis.spring.mapper.MapperScannerConfigurer">    < Propertyname= "Basepackage"value= "Com.adu.spring_test.mybatis.dao" />    < Propertyname= "Sqlsessionfactorybeanname"value= "Sqlsessionfactory" /></Bean>

3. Solution

Reduce the level of autowired detection by changing the level of severity from previous error to warning or other levels that can be ignored.

Reference:

    • Spring Annotated mode idea could not autowire,eclipse but no problem

IntelliJ idea cancels could not autowire. No beans of ' xxxx ' type found error hint

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.