Spring安全警告:Class AuthorityUtils是抽象的



由于转到了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>

关于这件事的根本原因有什么想法吗?我们的项目不会容忍虚假的警告,我不想禁用Springbean验证。

正如Luke Taylor所指出的,这是Spring Tool Suite 3.6.0版本中的一个错误。错误报告位于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版本

最新更新