Java 创建名为';org.springframework.security.web.DefaultSecurityFilterChain
我正在创建一个spring网站,在没有maven的netbeans中具有安全性。我一直在阅读关于在pom.xml中添加依赖项的内容,但我没有使用maven创建我的项目,因此没有pom.xml文件。在尝试设置安全性时,我不断遇到此错误。错误发生在spring-security.xml文件中。如果我不将它添加到web.xml中,项目工作正常,但当我将它包含在web.xml中时,它就不工作了。我从maven数据库复制了spring security Jar/文件夹 这是我的web.xmlJava 创建名为';org.springframework.security.web.DefaultSecurityFilterChain,java,spring,spring-mvc,spring-security,netbeans-8,Java,Spring,Spring Mvc,Spring Security,Netbeans 8,我正在创建一个spring网站,在没有maven的netbeans中具有安全性。我一直在阅读关于在pom.xml中添加依赖项的内容,但我没有使用maven创建我的项目,因此没有pom.xml文件。在尝试设置安全性时,我不断遇到此错误。错误发生在spring-security.xml文件中。如果我不将它添加到web.xml中,项目工作正常,但当我将它包含在web.xml中时,它就不工作了。我从maven数据库复制了spring security Jar/文件夹 这是我的web.xml <?x
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.1" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd">
<!-- Configs -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml
/WEB-INF/spring-security.xml</param-value>
</context-param>
<!--- Listeners -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<listener>
<listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
</listener>
<!-- Spring MVC DispatcherServlet -->
<servlet>
<servlet-name>dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>*.html</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>
3
</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>redirect.jsp</welcome-file>
</welcome-file-list>
<!-- Spring Security -->
<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
<init-param>
<param-name>contextAttribute</param-name>
<param-value>org.springframework.web.context.WebApplicationContext.ROOT</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>
上下文配置位置
/WEB-INF/applicationContext.xml
/WEB-INF/spring-security.xml
org.springframework.web.context.ContextLoaderListener
org.springframework.web.context.request.RequestContextListener
调度员
org.springframework.web.servlet.DispatcherServlet
1.
调度员
*.html
3.
redirect.jsp
springSecurityFilterChain
org.springframework.web.filter.DelegatingFilterProxy
上下文属性
org.springframework.web.context.WebApplicationContext.ROOT
springSecurityFilterChain
/*
这是我的spring-security.xml
<?xml version="1.0" encoding="UTF-8"?>
<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-4.0.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security-3.2.xsd">
<http auto-config="true">
<intercept-url pattern="/admin*" access="ROLE_ADMIN" />
<form-login login-page='login.jsp'/>
<logout logout-success-url="/index" />
</http>
<authentication-manager>
<authentication-provider>
<user-service>
<user name="lun" password="lun" authorities="ROLE_ADMIN" />
</user-service>
</authentication-provider>
</authentication-manager>
</beans:beans>
“来自maven呼吸系统”-您要查找的单词是:repository.)您是否也添加了过渡依赖项?你得到了什么?除此之外:我强烈建议您使用依赖关系管理工具,如maven、gradle(它在下面使用maven)、ivy等。它将为您节省大量时间,并防止您处理丢失的jar或错误版本的jar。