我按照文档配置SpringPlugin,但是我在一些Interceptor和Listener上配置@Before(IocInterceptor.class)后没有自动注入。把IocInterceptor配置成全局的也是一样。
applicationContext.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"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="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">
<context:annotation-config/>
</beans>
Interceptor:
@Before(IocInterceptor.class)
public class AccessLogInterceptor implements Interceptor
{
@Inject.BY_NAME
private SessionService sessionService;
@Override
public void intercept(ActionInvocation ai)
{
...
sessionService.updateSession(session, url);
ai.invoke();
}
}
谁知道有没有不用SpringPlugin,直接用Spring的方法?
尝试了配置org.springframework.web.context.ContextLoaderListener没有成功。
将 IocInterceptor 这个拦截器配置成全局的,或者配置在 Controller 上,然后使用 @Inject.BY_NAME、@Inject.BY_TYPE进行注入配置
楼主代码中将 IocInterceptor 配置在了 Interceptor 之上,这肯定不会起作用,拦截器只能应用在 Controller 之上
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。