2015-09-30 63 views
0

經過一段時間編程之後,我正在嘗試關於Angular Twitter Bootstrap Spring MVC, Data and Security(它是用葡萄牙語撰寫的)教程。創建名爲'org.springframework.security.filterChains'的bean時出現安全性錯誤'

在Eclipse中的所有錯誤被糾正,所有看起來很好,但是當我嘗試使用

MVN運行乾淨安裝tomcat7:運行

我拿到常規控制檯輸出及以下錯誤。我在調試時非常生鏽。

[ERROR] Context initialization failed 
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.filterChains': Cannot resolve reference to bean 'org.springframework.security.web.DefaultSecurityFilterChain#0' while setting bean property 'sourceList' with key [0]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.web.DefaultSecurityFilterChain#0': Cannot resolve reference to bean 'org.springframework.security.web.access.intercept.FilterSecurityInterceptor#0' while setting constructor argument with key [9]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.web.access.intercept.FilterSecurityInterceptor#0': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Unsupported configuration attributes: [isAuthenticated(), permitAll] 

我的彈簧jpa.xml是

<?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:mvc="http://www.springframework.org/schema/mvc" 
    xmlns:context="http://www.springframework.org/schema/context" 
    xmlns:jee="http://www.springframework.org/schema/jee" 
    xmlns:jpa="http://www.springframework.org/schema/data/jpa" 
    xmlns:tx="http://www.springframework.org/schema/tx" 
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd 
         http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd 
         http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd 
         http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee.xsd 
         http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd 
         http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa.xsd 
         http://www.springframework.org/schema/context http://www.springframework.org/schema/task/spring-context.xsd"> 

<!-- JPA Configurations --> 
<jee:jndi-lookup id="myContactDataSource" jndi-name="jdbc/tomcatDataSource" lookup-on-startup="false" 
       proxy-interface="javax.sql.DataSource"/> 

<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager"/> 

<tx:annotation-driven transaction-manager="transactionManager"/> 

<bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor"/> 
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"> 
    <property name="persistenceProviderClass" value="org.hibernate.ejb.HibernatePersistence"/> 
    <property name="dataSource" ref="myContactDataSource"/> 
    <property name="persistenceUnitName" value="debtsPU"/> 
    <property name="persistenceXmlLocation" value="classpath:META-INF/persistence.xml" /> 

</bean> 

<!-- Spring Data --> 
<jpa:repositories base-package="br.com.biologistica.debt.repository" 
        entity-manager-factory-ref="entityManagerFactory" 
        transaction-manager-ref="transactionManager"/> 

我的彈簧安全:

<?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:security="http://www.springframework.org/schema/security" 
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd 
    http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security.xsd"> 

<security:global-method-security secured-annotations="enabled" /> 
    <security:http auto-config="true"> 
    <security:intercept-url pattern="/" access="permitAll" /> 
    <security:intercept-url pattern="/protected/**" access="isAuthenticated()" /> 

    <security:form-login login-page="/login" authentication-failure-url="/login?error=403" default-target-url="/protected/home" /> 

    <security:logout invalidate-session="true" logout-success-url="/login" logout-url="/logout" /> 
</security:http> 
<security:authentication-manager> 
    <security:authentication-provider> 
     <security:jdbc-user-service 
       data-source-ref="myContactDataSource" 
       users-by-username-query="select email, password, enabled from system_user where email = ?" 
       authorities-by-username-query="select u.email as login, u.user_role as role from system_user u where u.email = ?" /> 
    </security:authentication-provider> 
</security:authentication-manager> 
</beans> 

數據庫PostgreSQL的是。

這裏似乎是什麼問題?

由於提前,

gtludwig

+1

正如[此]提及(http://stackoverflow.com/questions/3388779/websphere-unsupported -configuration-attributes-permitall-using-spring)後,使用 user2953113

+0

它工作!謝謝!發佈這個答案,我會接受它! – gtludwig

+1

很高興它工作,我已經發布它作爲答案。 – user2953113

回答

1

this訊息中提到,使用<http auto-config="true" use-expressions="true">

相關問題