你知道这是什么原因吗?

Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/security]

org.springframework.web.context.ContextLoader initWebApplicationContext: Context initialization failed
org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/security]
Offending resource: ServletContext resource [/WEB-INF/applicationContext.xml]

这是我的应用程序上下文.xml:

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

在我的pom里.我有:

<dependency>
    <groupId>org.springframework.security</groupId>
    <artifactId>spring-security-core</artifactId>      
    <version>3.0.1.RELEASE</version>
</dependency>
<dependency>
    <groupId>org.springframework.security</groupId>
    <artifactId>spring-security-openid</artifactId>
    <version>3.0.1.RELEASE</version>
</dependency>

推荐答案

我需要添加一个额外的Maven依赖项:

    <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-config</artifactId>
        <version>3.0.1.RELEASE</version>
    </dependency>

Java相关问答推荐

Spicejet日历处理-使用Selenium Java

如果它最终将被转换为int类型,为什么我们在Java中需要较小的integer类型?

无法在Java中将hhmmss格式的时间解析为LocalTime

在现代操作系统/硬件上按块访问数据值得吗?

为什么Java的代码工作(if condition内部的实例)

Java Swing:初始化身份验证类后未检测到ATM_Interface键事件

按属性值从流中筛选出重复项

如何使用带有谓词参数的方法,而不使用lambda表达式

有没有更快的方法在N个容器中删除重复项?

没有使用Lombok生成的参数

Java中不兼容的泛型类型

Oj算法 MatrixR032从字符串、归一化和余弦相似度计算创建

如何使这两种方法合二为一?

带有可选部分的Java DateTimeForMatter

何时调用密封层次 struct 的switch 中的默认情况

Java集合:NPE,即使没有添加空值

Android无法在Java代码中调用Kotlin代码,原因是在Companion中使用Kotlin枚举时

Java CDI:@Singleton@Startup@Inject无法实现接口

HBox内部的左对齐按钮(如果重要的话,在页码内)

AspectJ编织外部依赖代码,重新打包jar并强制依赖用户使用它