Spring Security警告:类AuthorityUtils是抽象的吗?

时间:2014-11-06 02:31:27

标签: java xml spring configuration spring-security

自从迁移到Spring Security 3.2.5.RELEASE和Spring 4.1.1.RELEASE以来,我们在Eclipse(Luna)中收到了一个Spring Bean Validation警告。

确切的警告是:

Class 'org.springframework.security.core.authority.AuthorityUtils' is abstract

以下是此Spring文件的标题:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:tx="http://www.springframework.org/schema/tx" xmlns:springsecurity="http://www.springframework.org/schema/security"
    xmlns:jaxrs="http://cxf.apache.org/jaxrs" xmlns:cxf="http://cxf.apache.org/core"
    xmlns:jee="http://www.springframework.org/schema/jee"
    xsi:schemaLocation="http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-4.1.xsd
        http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
        http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.2.xsd
        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.1.xsd
        http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd
        http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.1.xsd">

配置的违规部分如下(意味着如果我删除此部分,则错误消失。具体来说,如果我删除springsecurity:authentication-provider节:

<springsecurity:authentication-manager alias="authenticationManager">
    <springsecurity:authentication-provider>
        <springsecurity:user-service>
            <springsecurity:user name="john" password="john"
                authorities="ROLE_USER" />
            <springsecurity:user name="admin" password="admin"
                authorities="ROLE_USER, ROLE_ADMIN" />
            <springsecurity:user name="guest" password="guest"
                authorities="ROLE_GUEST" />
        </springsecurity:user-service>
    </springsecurity:authentication-provider>
</springsecurity:authentication-manager>

关于这个根本原因的任何想法?我们的项目没有提出虚假警告,我也不想禁用Spring bean验证。

1 个答案:

答案 0 :(得分:3)

这是Spring Tool Suite 3.6.0版中的一个错误,正如Luke Taylor指出的那样。错误报告位于https://issuetracker.springsource.com/browse/STS-3875,并且在STS版本3.6.3之前无法修复。您可以在http://www.docjar.com/html/api/org/springframework/orm/jpa/SharedEntityManagerCreator.java.html

检查此类的代码

[编辑]错误报告指出此错误现已修复。修复程序在3.6.4版本中