xml - Spring Security : no bean is named "springSecurityFilterChain" defined error -


i'm having trouble setting spring security in maven webapp project. whenever run app on server displays following error :

org.springframework.beans.factory.nosuchbeandefinitionexception: no bean named 'springsecurityfilterchain' defined 

now know question has been asked , have been trying various solutions proposed since yesterday no avail.

note spring-security.xml , spring-database.xml inside folder named spring in web-inf directory while applicationcontext.xml in web-inf dir.

here config files :

web.xml :

<web-app>   <display-name>archetype created web application</display-name> <context-param>     <param-name>contextconfiguration</param-name>     <param-value>             /web-inf/spring/spring-security.xml             /web-inf/spring/spring-database.xml             /web-inf/applicationcontext.xml     </param-value> </context-param>  <!-- spring security --> <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>  <listener>     <listener-class> org.springframework.web.context.contextloaderlistener </listener-class> </listener>  <servlet>     <servlet-name>appservlet</servlet-name>     <servlet-class>org.springframework.web.servlet.dispatcherservlet</servlet-class>     <load-on-startup>1</load-on-startup> </servlet>  <servlet-mapping>     <servlet-name>appservlet</servlet-name>     <url-pattern>/</url-pattern> </servlet-mapping> 

spring-security.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.xsd http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security.xsd">  <http auto-config="true" use-expressions="true">     <access-denied-handler error-page="/403" />     <intercept-url pattern="/admin**" access="hasrole('role_admin')" />     <form-login          login-page="/login"          default-target-url="/admin"          authentication-failure-url="/login?error"          username-parameter="username"         password-parameter="password" />     <logout logout-success-url="/login?logout" invalidate-session="true"/>     <!-- enable csrf protection -->     <csrf/> </http>   <authentication-manager>   <authentication-provider>     <jdbc-user-service data-source-ref="datasource"       users-by-username-query=         "select login,pwd, enabled utilisateur login=?"       authorities-by-username-query=         "select login, role role login =?" />   </authentication-provider> </authentication-manager> 

applicationcontext.xml :

<?xml version="1.0" encoding="utf-8"?> <beans:beans xmlns="http://www.springframework.org/schema/mvc" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:beans="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xsi:schemalocation="http://www.springframework.org/schema/mvc    http://www.springframework.org/schema/mvc/spring-mvc.xsd     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">  <!-- dispatcherservlet context: defines servlet's request-processing infrastructure -->  <!-- enables spring mvc @controller programming model --> <annotation-driven />  <!-- handles http requests /resources/** efficiently serving static resources in ${webapproot}/resources directory --> <resources mapping="/resources/**" location="/resources/" />  <!-- resolves views selected rendering @controllers .jsp resources in /web-inf/views directory --> <beans:bean class="org.springframework.web.servlet.view.internalresourceviewresolver">     <beans:property name="prefix" value="/web-inf/vues/" />     <beans:property name="suffix" value=".jsp" /> </beans:bean>  <context:component-scan base-package="com.myapp.controllers" />  </beans:beans> 

spring-database.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"     xsi:schemalocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">      <bean id="datasource"         class="org.springframework.jdbc.datasource.drivermanagerdatasource">          <property name="driverclassname" value="com.mysql.jdbc.driver" />         <property name="url" value="jdbc:mysql://localhost:3306/wfmconf" />         <property name="username" value="root" />         <property name="password" value="the_master123456" />     </bean>  </beans> 

edit :

i have specified both applicationcontext , spring-security configuration files context parameteres correct url in web.xml

i have found problem. context-param name should contextconfiglocation instead of contextconfiguration , applicationcontext.xml should specified init-param servlet.

so correct web.xml :

<web-app>   <display-name>archetype created web application</display-name> <context-param>     <param-name>contextconfiglocation</param-name>     <param-value>             /web-inf/spring/spring-security.xml             /web-inf/spring/spring-database.xml     </param-value> </context-param>  <!-- spring security --> <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>  <listener>     <listener-class> org.springframework.web.context.contextloaderlistener </listener-class> </listener>  <servlet>     <servlet-name>appservlet</servlet-name>     <servlet-class>org.springframework.web.servlet.dispatcherservlet</servlet-class>     <init-param>         <param-name>contextconfiglocation</param-name>         <param-value>/web-inf/applicationcontext.xml</param-value>     </init-param>     <load-on-startup>1</load-on-startup> </servlet>  <servlet-mapping>     <servlet-name>appservlet</servlet-name>     <url-pattern>/</url-pattern> </servlet-mapping>