java - Referenced Bean not found -
i new spring , using spring 3.2.5 release. have custom userdetailssevice called mongouserdetailsservice. application-security.xml.
<http auto-config="true"> <intercept-url pattern="/secured/*" access="role_user" /> <form-login login-processing-url="/login" login-page="/loginpage" username-parameter="username" password-parameter="password" default-target-url="/secured/mypage" authentication-failure-url="/loginpage?auth=fail" /> <logout logout-url="/logout" logout-success-url="/logoutpage" /> </http> <authentication-manager alias="authenticationmanager"> <authentication-provider user-service-ref="mongouserdetailsservice"> <password-encoder hash="plaintext" /> </authentication-provider> </authentication-manager>
and here dispatcher-servlet.xml
<context:component-scan base-package="com.srccodes.spring.controller" /> <mvc:annotation-driven /> <bean id="viewresolver" class="org.springframework.web.servlet.view.internalresourceviewresolver"> <property name="prefix" value="/web-inf/pages/" /> <property name="suffix" value=".jsp" /> </bean> <bean id="mongouserdetailsservice" class="com.srccodes.spring.security.mongouserdetailsservice"> </bean>
i receive bean not found error in application-security.xml authentication-provider provided. have checked paths , correct.
i adding web.xml well.
<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>/</url-pattern> </servlet-mapping> <!-- spring context files loaded --> <context-param> <param-name>contextconfiglocation</param-name> <param-value> /web-inf/applicationcontext.xml, /web-inf/application-security.xml, /web-inf/mongo-config.xml </param-value> </context-param> <listener> <listener-class>org.springframework.web.context.contextloaderlistener</listener-class> </listener> <!-- filter declaration 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>
in application-security.xml file must import dispatcher-servlet.xml following code showing import sysntax: 1- if dispatcher-servlet.xml buildpath:
<import resource="classpath:dir/dispatcher-servlet.xml" />
2- if web-inf dir
<import resource="dir/dispatcher-servlet.xml" />
i hope you
Comments
Post a Comment