0
こんにちは私はSpringのセキュリティと冬眠を含むspring mvc Webアプリケーションを開発しようとしています。私はGoogleで検索しましたが、web.xmlファイルでspring mvc設定とspringセキュリティ設定をどのように結びつけるかを理解できませんでした。最後に、以下のようにweb.xmlファイルを実装しますが、このエラーが発生しています。spring-mvcとspring-securityのweb.xmlを正しく実装する方法
org.springframework.beans.factory.NoSuchBeanDefinitionException:という名前のBeanのspringSecurityFilterChain「私のweb.xmlがcorretly実装されている場合
はあなたが私に言うことができる利用可能?事前に
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1">
<display-name>SPY</display-name>
<filter>
<filter-name>encoding-filter</filter-name>
<filter-class>
org.springframework.web.filter.CharacterEncodingFilter
</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
<init-param>
<param-name>forceEncoding</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>encoding-filter</filter-name>
<url-pattern>/</url-pattern>
</filter-mapping>
<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/security.xml</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/</url-pattern>
</filter-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring.xml, WEB-INF/security.xml</param-value>
</context-param>
<servlet>
<servlet-name>dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
</web-app>
おかげで,,以下のようにweb.xml内のContextLoaderListenerを追加
ありがとうございました。要素の順序は重要ですか?私は、context-paramが最初でなければならないことを意味し、リスナーは後に続きます。それは重要です。 –
はい、XSDでは、要素が特定の順序でリストされている必要があります。 – mhshimul