自从迁移到
Spring Security 3.2.5.RELEASE和Spring 4.1.1.RELEASE以来,我们在
Eclipse(Luna)中收到了一个Spring Bean Validation警告.
确切的警告是:
类’org.springframework.security.core.authority.AuthorityUtils’是抽象的
<?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验证.
解决方法
正如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检查此类的代码