java - 在 Intellij Ultimate 中为简单的 Spring 应用程序设置 applicationContext.xml

标签 java spring intellij-idea

我是 Spring 的新手,我正在尝试设置一个简单的 Spring 应用程序,我正在通过在线教程进行操作。然而导师正在使用 Eclipse,而 IntelliJ 正在提示

Cannot find the declaration of element 'beans'. 

....来自 applicationContext.xml

我唯一的 Spring POM 依赖项:

    <dependency>
       <groupId>org.springframework</groupId>
       <artifactId>spring-core</artifactId>
       <version>5.1.9.RELEASE</version>
    </dependency>

我的applicationContext.xml

enter image description here

我必须从项目结构中的“Facets”上下文菜单中进行设置吗?如果是这样,怎么办?

我拥有捆绑在典型 Ultimate 安装中的所有标准 Spring 插件:

enter image description here

我的项目结构:

enter image description here

最佳答案

除了 Spring Core 之外,您还必须对 Spring Bean 使用以下依赖项。

<!-- https://mvnrepository.com/artifact/org.springframework/spring-beans -->
<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-beans</artifactId>
    <version>5.1.9.RELEASE</version>
</dependency>

关于java - 在 Intellij Ultimate 中为简单的 Spring 应用程序设置 applicationContext.xml,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57363035/

相关文章:

java - 基于 MATLAB 的 Java 程序

java - 在哈希码方法中使用 ^ 的原因是什么?

java - Spring @scheduled 带有 cron 但没有重叠的 cron

java - 无法 Autowiring 。找不到 `Repository' 类型的 bean

java - 打开文件以查看其内容

java - Lucene 连字符词的索引/查询策略

java - 具有多个 JdbcTemplate 和 Spring Boot 的 NoSuchBeanDefinitionException

java - Camel HTTP 的截断响应

intellij-idea - Mockito 处于 Debug模式,断点结果为 WrongTypeOfReturnValue

java - Maven - 外部库中的依赖项不会复制到目标文件夹