严重:启动筛选器springSecurityFilterChain org.SpringFramework.Beans.Factory.NoSuchBeanDefinitionException:否
名为“Spring SecurityFilterChain”的bean在org.springframework.beans.factory.support.defaultlistablebeanfactory.getBeandefinition(defaultlistablebeanfactory.java:553)在org.springframework.beans.factory.support.abstractbeanfactory.getmergedlocalbeandefinition(abstractbeanfactory.1095)在
以下是我的配置文件:
web.xml
<display-name>myTest</display-name>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring/root-context.xml</param-value>
</context-param>
<context-param>
<param-name>defaultHtmlEscape</param-name>
<param-value>true</param-value>
</context-param>
<!-- Creates the Spring Container shared by all Servlets and Filters -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<listener>
<listener-class>org.springframework.security.web.session.HttpSessionEventPublisher</listener-class>
</listener>
<!-- Processes application requests -->
<servlet>
<servlet-name>springTest</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring/servlet-context.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>springTest</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
这是root-context.xml
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:c="http://www.springframework.org/schema/c" xmlns:context="http://www.springframework.org/schema/context"
xmlns:p="http://www.springframework.org/schema/p" xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.1.xsd">
<context:annotation-config />
<context:component-scan base-package="com.myTest.db.entities"/>
<context:component-scan base-package="com.myTest.services"/>
<context:component-scan base-package="com.myTest.web"/>
<import resource="mvc-config.xml" />
这是
security-config.xml
<beans:beans xmlns="http://www.springframework.org/schema/security" xmlns:beans="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.1.xsd">
<!-- Additional filter chain for normal users, matching all other requests -->
<http pattern="/resources/**" security="none" />
<http use-expressions="true">
<intercept-url pattern="/login" access='isAnonymous()' requires-channel='http' />
<intercept-url pattern="/" access='permitAll' requires-channel='http'/>
<intercept-url pattern='/**' access='isAuthenticated()' requires-channel='http'/>
<form-login login-page="/login" authentication-failure-url="/login" default-target-url="/welcome" />
<access-denied-handler ref="accessDeniedHandler" />
<logout logout-url="/logout" logout-success-url="/" />
</http>
<beans:bean id="accessDeniedHandler" class="org.springframework.security.web.access.AccessDeniedHandlerImpl">
<beans:property name="errorPage" value="/WEB-INF/pages/error.jsp"/>
</beans:bean>
<authentication-manager>
<authentication-provider user-service-ref="userAuthenticationService">
<password-encoder hash="sha-256">
<salt-source user-property="salt" />
</password-encoder>
</authentication-provider>
</authentication-manager>
<!-- User Detail Services -->
<beans:bean id="userAuthenticationService" class="com.myTest.security.AuthenticationServiceImpl" />
有什么想法吗?
web.xml中缺少security-config.xml项
你可能需要这样的东西:
<param-value>/WEB-INF/spring/security-config.xml</param-value>
行后
<param-value>/WEB-INF/spring/root-context.xml</param-value>
我正在尝试编写Spring应用程序,我有这个代码,但是当使用Tomcat 8运行这个代码时,出现了这个错误,我不知道错误的根本原因是什么,请帮助 错误: 网状物xml: WebSecurityConfig.xml
我从一个工作的Spring配置的Web应用程序开始,并且一直在Spring上下文配置文件中的beans标记中添加Spring配置文件:
在启动 Websphere liberty 服务器时注意到以下异常。如何删除它?感谢任何帮助。我们同时安装了javaee7配置文件和webProfile-6.0功能。EAR 应用程序有一个使用 jee6.0 / “3.0” web的 WAR 文件.xml
我在Spring-MVC+JPA上有应用。我建立战争并尝试在Tomcat上开始。 DataConfig: app.properties为: 因此,tomcat日志中会出现错误消息:
我想在Spring中处理某些异常并将REST响应包装成另一种对象格式。 因此,我想到了使用过滤器并检查响应状态代码的想法,例如,如果是400,则意味着请求不正确,因此我可以将响应包装为所需的JSON格式,下面是代码示例: 将特定异常的响应封装在过滤器中是一种好方法吗?这种情况的缺点是什么?
我在启动Spring Boot应用程序时遇到以下异常。Spring Boot版本:2.1.13 Spring Framework版本:5.1.14 原因:原因:com.datastax.driver.core.exceptions.driverinternalerror:在类路径中检测到不兼容的Guava版本。你需要16.0.1或更高。在com.datastax.driver.core.guava