intellij - spring is not being recognized (Unmapped Spring configuration)

SpringMavenIntellij Idea

Spring Problem Overview


I am using IntelliJ IDEA and all plugins for Spring are activated, but when I load my Maven project I have the following error:

>Spring Configuration Check
>Unmapped Spring configuration files found.
>Please configure/setup Spring facet for modules

Any ideas what prevented it from being configured automatically?

Spring Solutions


Solution 1 - Spring

You need to do the following:

  1. Go to the project structure dialog (either by clicking the warning or through file=>project structure
  2. select the modules item in the left hand list
  3. go through and right click on the modules with missing files and select Add=>Spring
  4. in the new tab click the + button
  5. you should now see a list of the xml files. Check the boxes next to them

It's not entirely clear to me what this achieves apart from getting rid of the warnings! If anyone could shed any light on that it'd be good.

Solution 2 - Spring

You need to check which configurations IntelliJ will use to provide inspections on wired beans.

Go to FileProject StructureProject SettingsModules.

Select your module and selected (or add) the Spring facet.
In the right area you can add or modify application contexts that are used by your module. Just check every configuartion you need in your context.

Solution 3 - Spring

In addition to the above steps (in Bart's answer) , I had to

 1. click on the unmapped spring beans from the warning dialog box 
 2. select all the beans file
 3. set application context as "Spring Application Context" (You many want to change it to other contexts, if you need)

and it worked for me.

Solution 4 - Spring

If you just want to disable the notifications, just do this:

IntelliJ > Preferences > Notifications > Spring Configuration Check > No popup

Solution 5 - Spring

If you are working with Gradle in Intellij, try the refresh ("Reload All Gradle Projects") button. It should make all of your Spring and other annotations recognizable by IDE, assuming you have properly defined your dependencies in build.gradle file.

enter image description here

Solution 6 - Spring

I just wanted to add that for our project (idea 13), looking at FileProject StructureProject SettingsModules (Spring) everything looked correct, but that then when you highlight all of them and click the edit pencil that is when we could truly see the ones that it is complaining about. In our case they were all in our exploded war directory, so they only showed up after a full initial build.

Solution 7 - Spring

Same situation with my team, appeared that the "Import Maven project automatically" (Settings / Maven / Importing) is not checked on a fresh IntelliJ installation.

So check it and next time you'll import a Spring based project pom.xml file in "Maven projects" window, then a green window will appear up right and will wait for your validation to trigger the parsing of Spring configuration files detected.

Hope it helps!

EDIT : at this time, using JDK 1.7 instead of 1.8 + start from a extra-simple fresh "empty project" (IntelliJ) had seemed necessary too on a other colleague laptop

Solution 8 - Spring

Many answers or 6+ years old, so this is more current 2021-06 and while they are all still accurate AFAIK, the UI now gives a link to a help page that I'm including next.

When using IntelliJ Ultimate 2021.1 (probably applies to earlier releases), the Show help link sends you to this page: https://www.jetbrains.com/help/idea/2021.1/spring-support.html#spring-file-set

This page shows this image: enter image description here

Which also says: > If the Spring facet is configured correctly, you will see Spring gutter icons marking each component, bean, and so on.

Other answers also mentioned that if this isn't configured, everything still works (which was good for me to hear/read).

Solution 9 - Spring

Steps to follow

  1. Go to File
  2. Select Project Structure
  3. From the left-hand side of Project Settings, select Modules.
  4. Right-click on your project, select +Add, and select Spring
  5. Application, Application Bootstrap, and Application MVC will be there

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionakalizaView Question on Stackoverflow
Solution 1 - SpringJonnyRaaView Answer on Stackoverflow
Solution 2 - SpringBartView Answer on Stackoverflow
Solution 3 - SpringKrishna SapkotaView Answer on Stackoverflow
Solution 4 - SpringCory KleinView Answer on Stackoverflow
Solution 5 - SpringbartoniView Answer on Stackoverflow
Solution 6 - SpringUncle IrohView Answer on Stackoverflow
Solution 7 - SpringlboixView Answer on Stackoverflow
Solution 8 - SpringPatSView Answer on Stackoverflow
Solution 9 - SpringCodingBeeView Answer on Stackoverflow