Autowiring Spring bean in IntelliJ

Having one of the following errors in IntelliJ?

Could not autowire. No beans of 'yourType' type found

or

Could not autowire. There is more than one bean of 'yourType' type.

If you’re sure you have your Spring bean definitions correct (for me, the application works fine, it just displays an annoying error in the IDE), check your project ‘iml’ file if you have a Spring facet defined.

<facet type="Spring" name="Spring">
  <configuration>
    <fileset id="web: application context" name="MVC application context" removed="false">
      <file>file://$MODULE_DIR$/src/main/resources/spring/applicationContext-interface.xml</file>
    </fileset>
  </configuration>
</facet>

After removing this facet everything works fine for me.

This entry was posted in Coding, IntelliJ, Java, Spring and tagged , , , , . Bookmark the permalink.

One Response to Autowiring Spring bean in IntelliJ

  1. Pete says:

    多谢你的博客!

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>