如何在IntelliJ IDEA中配置Spring方面

如何在IntelliJ IDEA中配置Spring方面,spring,intellij-idea,Spring,Intellij Idea,我是Intellij14.0的新手。我当时正在使用Netbeans,但我的同事告诉我要转向intellij,我也这么做了 我需要运行与我在Intellij中的netbeans上运行的项目相同的项目。我正在从事的项目是由grails和spring组成的。当我尝试使用Intellij运行项目时,我得到的就是这个 弹簧配置检查 找到未映射的Spring配置文件。 请为模块配置/设置Spring方面: ......... (1个文件) 这是文件 applicationContext.xml <?x

我是Intellij14.0的新手。我当时正在使用Netbeans,但我的同事告诉我要转向intellij,我也这么做了

我需要运行与我在Intellij中的netbeans上运行的项目相同的项目。我正在从事的项目是由grails和spring组成的。当我尝试使用Intellij运行项目时,我得到的就是这个

弹簧配置检查 找到未映射的Spring配置文件。 请为模块配置/设置Spring方面: ......... (1个文件)

这是文件

applicationContext.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">

    <bean id="grailsApplication" class="org.codehaus.groovy.grails.commons.GrailsApplicationFactoryBean">
        <description>Grails application factory bean</description>
        <property name="grailsDescriptor" value="/WEB-INF/grails.xml" />
        <property name="grailsResourceLoader" ref="grailsResourceLoader" />
    </bean>

    <bean id="pluginManager" class="org.codehaus.groovy.grails.plugins.GrailsPluginManagerFactoryBean">
        <description>A bean that manages Grails plugins</description>
        <property name="grailsDescriptor" value="/WEB-INF/grails.xml" />
        <property name="application" ref="grailsApplication" />
    </bean>

    <bean id="grailsConfigurator" class="org.codehaus.groovy.grails.commons.spring.GrailsRuntimeConfigurator">
        <constructor-arg>
            <ref bean="grailsApplication" />
        </constructor-arg>
        <property name="pluginManager" ref="pluginManager" />
    </bean>

    <bean id="grailsResourceLoader" class="org.codehaus.groovy.grails.commons.GrailsResourceLoaderFactoryBean" />

    <bean id="characterEncodingFilter" class="org.springframework.web.filter.CharacterEncodingFilter">
        <property name="encoding">
            <value>utf-8</value>
        </property>
    </bean>

    <bean id="conversionService" class="org.springframework.context.support.ConversionServiceFactoryBean" />
</beans>

Grails应用程序工厂bean
管理Grails插件的bean
utf-8
老实说,我不知道怎么修理它。根据我的理解,它正在寻找一些模块,但我无法修复它。我甚至尝试过“添加框架支持”。但是我在列表中找不到spring

你能帮我修一下吗?谢谢

转到文件/项目结构/模块,单击绿色加号图标,从下拉列表中选择Spring,然后在下一个对话框中选择您的模块

然后单击右窗格中的绿色加号,单击加号并选择您的Spring配置文件和类,然后单击OK


还可以看看Spring方面。

IntelliJ Ultimate 2018-手动方式:

  • 菜单文件->项目结构
  • 右键单击模块并选择“添加…”->Spring
  • 如果spring未作为依赖项列出,则可以选择单击“修复”
  • 单击顶部的+图标添加spring configuration.xml文件
  • 自动方式:

  • 单击弹出通知的正文
  • 单击“创建默认值”选项

  • 今天突然遇到了这个问题,我的构建昨晚开始工作,今天早上它停止工作了,所以我想我应该使用IntelliJIDE CE 2019.1发布我的解决方案

    错误消息(帮助人们找到此答案)


    解决方案 步骤0: 更新IntelliJ

    Menu: IntelliJIDE > Check for Updates (Mac OSX) 
    
    步骤1: 清除Maven repo并重新下载依赖项,以确保源代码未损坏。这将需要5分钟以上的时间

    $ cd [project_directory]
    $ mvn dependency:purge-local-repository
    
    步骤2: 预成型一个干净的安装

    $ mvn clean install
    
    步骤3: 更新IntelliJIDE的存储库索引:

  • 打开IntelliJ设置/首选项
  • 构建、执行、部署>构建工具>Maven>存储库
  • 逐个选择存储库(通过单击表行)并单击更新按钮。具体来说,为执行此操作。下载容量为±700mb,因此需要一段时间。(10分钟以上)

  • 相关问题


    不确定这是否是版本差异和/或操作系统差异,但在Mac的IDEA 2017.1.3中,有一个与“模块”分开的“Facets”选项。此外,加号图标是黑色的,而不是绿色的。@M.Justin在windows 2017.1上也有刻面。但它的优点是绿色的。在我的例子中,它没有产生任何差异——我在重启后也有相同的消息。但是它是什么呢?它的用途是什么?这并不能解决问题。这仍然是一个很有帮助的答案。
    $ mvn clean install