Home   Single Page

/WEB-INF/web.xml ファイルの構成

Tomcat でスプリングセキュリティが適切に動作するためには、 以下に述べるように、spring-security 構成ファイルの位置と、スプリングのリスナーおよび spring-security フィルターを定義して指定しておく必要があります。

<!--
- Location of the XML file that defines the root application context
- Applied by ContextLoaderListener.
-->

<context-param>

<param-name>contextConfigLocation</param-name>

<param-value>

...

/WEB-INF/applicationContext-security.xml

</param-value>

</context-param>

<!--
- Loads the root application context of this web app at startup.
- The application context is then available via
- WebApplicationContextUtils.getWebApplicationContext(servletContext).
-->
<listener>

<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>

</listener>

<!--
- Spring Security Filter Chains
-->

<filter>

<filter-name>springSecurityFilterChain</filter-name>

<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>

</filter>