intellij - 无法识别 spring(未映射的 Spring 配置)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/22063533/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
intellij - spring is not being recognized (Unmapped Spring configuration)
提问by akaliza
I am using IntelliJ IDEA and all plugins for Spring are activated, but when I load my Maven project I have the following error:
我正在使用 IntelliJ IDEA 并且 Spring 的所有插件都已激活,但是当我加载我的 Maven 项目时出现以下错误:
Spring Configuration Check
Unmapped Spring configuration files found.
Please configure/setup Spring facet for modules
Spring 配置检查未
映射的 Spring 配置文件已找到。
请为模块配置/设置 Spring facet
Any ideas what prevented it from being configured automatically?
有什么想法阻止它自动配置?
回答by JonnyRaa
Just to clarify the answers above, you need to do the following:
为了澄清上述答案,您需要执行以下操作:
- Go to the project structure dialog (either by clicking the warning or through file=>project structure
- select the modulesitem in the left hand list
- go through and right clickon the modules with missing files and select Add=>Spring
- in the new tab click the + button
- you should now see a list of the xml files. Check the boxes next to them
- 转到项目结构对话框(通过单击警告或通过 file=>project structure
- 选择左侧列表中的模块项
- 浏览并右键单击缺少文件的模块,然后选择Add=>Spring
- 在新选项卡中单击 + 按钮
- 您现在应该会看到一个 xml 文件列表。选中它们旁边的框
I'm not entirely clear what this achieves apart from getting rid of the warnings! If anyone could shed any light on that it'd be good.
除了摆脱警告之外,我并不完全清楚这能实现什么!如果有人能对此有所了解,那就太好了。
回答by Bart
You need to check which configurations IntelliJ will use to provide inspections on wired beans.
您需要检查 IntelliJ 将使用哪些配置来提供对有线 bean 的检查。
Go to File➝Project Structure➝Project Settings➝Modules.
转到File➝ Project Structure➝ Project Settings➝ Modules。
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.
选择您的模块并选择(或添加)Spring facet。
在右侧区域,您可以添加或修改模块使用的应用程序上下文。只需在您的上下文中检查您需要的每个配置。
回答by Krishna Sapkota
In addition to the above steps (in Bart's answer) , I had to
除了上述步骤(在 Bart 的回答中),我还必须
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.
它对我有用。
回答by Uncle Iroh
I just wanted to add that for our project (idea 13), looking at File➝ Project Structure➝ Project Settings➝ Modules(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.
我只是想为我们的项目(想法 13)添加它,看着File➝ Project Structure➝ Project Settings➝ Modules(Spring) 一切看起来都正确,但是当你突出显示所有这些并单击编辑铅笔时,我们才能真正看到那些它在抱怨。在我们的例子中,它们都在我们的爆炸War目录中,所以它们只在完整的初始构建后出现。
回答by lboix
Same situation with my team, appeared that the "Import Maven project automatically" (Settings / Maven / Importing) is not checked on a fresh IntelliJ installation.
与我的团队情况相同,似乎没有在全新的 IntelliJ 安装中检查“自动导入 Maven 项目”(设置 / Maven / 导入)。
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.
因此,请检查它,下次您将在“Maven 项目”窗口中导入基于 Spring 的项目 pom.xml 文件时,右侧将出现一个绿色窗口并等待您的验证以触发对检测到的 Spring 配置文件的解析。
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
编辑:此时,使用 JDK 1.7 而不是 1.8 + 从一个非常简单的新“空项目”(IntelliJ)开始在其他同事的笔记本电脑上似乎也是必要的
回答by Cory Klein
If you just want to disable the notifications, just do this:
如果您只想禁用通知,请执行以下操作:
IntelliJ > Preferences > Notifications > Spring Configuration Check > No popup