简体   繁体   English

创建名称为'org.springframework.security.filterChains'的bean时出现Spring Security错误

[英]Spring Security error while creating bean with name 'org.springframework.security.filterChains'

After a while away from programming, I'm attemping a tutorial on Angular Twitter Bootstrap Spring MVC, Data and Security (it's written in Portuguese). 离开编程一段时间后,我尝试了有关Angular Twitter Bootstrap Spring MVC,数据和安全性 (用葡萄牙语编写)的教程。

All errors on eclipse are corrected and all seems fine, but when I try to run it with eclipse上的所有错误均已纠正,并且看起来都不错,但是当我尝试使用

mvn clean install tomcat7:run mvn clean install tomcat7:运行

I get the regular console output and the following error. 我得到常规控制台输出和以下错误。 I'm very rusted on debugging this. 我对此调试感到非常沮丧。

[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]

My spring-jpa.xml is 我的spring-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"/>

And my spring-security is: 我的春季安全是:

<?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>

Database is PostgreSQL. 数据库是PostgreSQL。

What seems to be the issue here? 这里似乎是什么问题?

Thanks in advance, 提前致谢,

gtludwig 格鲁德维格

正如提到的后,使用<http auto-config="true" use-expressions="true">

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Spring-security:创建名为“org.springframework.security.filterChains”的bean时出错 - Spring-security: Error creating bean with name 'org.springframework.security.filterChains' 创建名称为&#39;org.springframework.security.filterChains&#39;的bean时出错(Spring Securiy) - Error creating bean with name 'org.springframework.security.filterChains' (Spring Securiy) 创建名为&#39;org.springframework.security.filterChains&#39;Spring + Hibernate + UserDetailService的bean时出错 - Error creating bean with name 'org.springframework.security.filterChains' Spring + Hibernate + UserDetailService Spring Security-org.springframework.beans.factory.BeanCreationException:创建名称为&#39;org.springframework.security.filterChains&#39;的bean时出错 - Spring security- org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.filterChains' org.springframework.beans.factory.BeanCreationException:创建名为“org.springframework.security.filterChains”的 bean 时出错: - org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.filterChains': 异常:org.springframework.beans.factory.BeanCreationException:创建名称为“ org.springframework.security.filterChains”的bean时出错 - Exception : org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.filterChains' Spring Security 3.1.x和JSF 2.0:“ BeanCreationException:创建名称为&#39;org.springframework.security.filterChains&#39;的bean时出错” - Spring Security 3.1.x & JSF 2.0 : “ BeanCreationException: Error creating bean with name 'org.springframework.security.filterChains' ” 创建名称为&#39;org.springframework.security.filterChains的bean时出错,设置bean属性&#39;sourceList&#39;时无法解析对bean的引用 - Error creating bean with name 'org.springframework.security.filterChains Cannot resolve reference to bean while setting bean property 'sourceList' 上下文初始化失败/创建名为“org.springframework.security.filterChains”的 bean 时出错 - Context initialization failed / Error creating bean with name 'org.springframework.security.filterChains' 创建bean&#39;org.springframework.security.filterChains&#39;时出错:无法解析&#39;org.springframework.security.web.DefaultSecurityFilterChain#0&#39; - Error creating bean 'org.springframework.security.filterChains': Cannot resolve 'org.springframework.security.web.DefaultSecurityFilterChain#0'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM