Spring-Security OAuth2设置 - 无法找到oauth2命名空间处理程序

Pet*_*ete 2 spring spring-security xml-namespaces oauth-2.0

我正在尝试使用spring-security为OAuth2设置我们的REST服务器.(服务器已经支持没有OAuth的spring-security).现在我尝试按照sparklr示例并将spring-security-oauth工件添加到我的maven(mvn依赖:树显示它可用)以及命名空间配置到我的spring-security-context.xml但是我得到的只是:

Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/security/oauth2]
Run Code Online (Sandbox Code Playgroud)

浏览http://www.springframework.org/schema/security/所有我看到的是.xsd文件但没有oauth2文件夹..怎么会这样?我假设sparklr示例是一个工作版本,所以我做错了什么?

这是我的spring-security-context标题:

<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:oauth="http://www.springframework.org/schema/security/oauth2"
    xmlns:sec="http://www.springframework.org/schema/security" 
    xsi:schemaLocation="
http://www.springframework.org/schema/security/oauth2 http://www.springframework.org/schema/security/spring-security-oauth2-1.0.xsd
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.1.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd">
Run Code Online (Sandbox Code Playgroud)

如果需要,这是maven设置:

    <dependency>
        <groupId>org.springframework.security.oauth</groupId>
        <artifactId>spring-security-oauth</artifactId>
        <version>1.0.0.RC2</version>
    </dependency>
Run Code Online (Sandbox Code Playgroud)

Dav*_*itz 7

您引用OAuth2但导入OAuth 1.将依赖项替换为

<dependency>
    <groupId>org.springframework.security.oauth</groupId>
    <artifactId>spring-security-oauth2</artifactId>
    <version>1.0.0.RELEASE</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)