web.xml
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/classes/spring/*.xml
</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
applicationContext.xml
<context:component-scan base-package="com"
use-default-filters="true">
<context:exclude-filter type="annotation"
expression="org.springframework.stereotype.Controller" />
</context:component-scan>
filter
public void init(FilterConfig fConfig) throws ServletException {
Log.info("init filter!");
this.applicationContext = WebApplicationContextUtils
.getRequiredWebApplicationContext(fConfig.getServletContext());
this.signatureVerifyService = this.applicationContext.getBean(
"signatureVerifyServiceImpl", SignatureVerifyService.class);
}
[color=red]哥们,如果你用的是注解,那就看applicationContext.xml这个中use-default-filters你就懂了![/color]
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/classes/spring/*.xml
</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
applicationContext.xml
<context:component-scan base-package="com"
use-default-filters="true">
<context:exclude-filter type="annotation"
expression="org.springframework.stereotype.Controller" />
</context:component-scan>
filter
public void init(FilterConfig fConfig) throws ServletException {
Log.info("init filter!");
this.applicationContext = WebApplicationContextUtils
.getRequiredWebApplicationContext(fConfig.getServletContext());
this.signatureVerifyService = this.applicationContext.getBean(
"signatureVerifyServiceImpl", SignatureVerifyService.class);
}
[color=red]哥们,如果你用的是注解,那就看applicationContext.xml这个中use-default-filters你就懂了![/color]