Spring 3.0 禁用@Inject注解处理
有没有办法禁用spring 3.0的@Inject
注解处理?
我试图将 CDI @Conversation 范围与 spring 一起使用,但是当涉及到
@Inject
private Conversation conversation;
spring 时,尝试自动连接显然失败的对话。
Is there a way to disable the @Inject
annotation processing of spring 3.0?
I'm trying to use the CDI @Conversation
Scope together with spring, but when it comes to
@Inject
private Conversation conversation;
spring tries to autowire the conversation which obviously failed.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为你不能。但 Spring 有自己的对话支持 - 看看 Spring Web Flow。
I don't think you can. But spring has its own conversation support - take a look at spring web flow.
我在尝试混合 Spring 3.x 和 CDI 注释时遇到了类似的问题。
我找到了一种在非 Spring bean 中禁用 Spring
@Inject
处理的方法;只需为使用@Named
注解的类创建一个排除过滤器:或者禁用类似以下的默认过滤器:
这之所以有效,是因为 Spring 默认为
javax.inject.Named
设置了一个包含过滤器激活 JSR-330 处理。I experienced a similar problem when trying to mix Spring 3.x and CDI annotations.
I found a way to disable Spring
@Inject
processing in non Spring beans; simply create an exclude filter for classes annotated with@Named
:or disable default filters something like:
This works because Spring sets by default an include filter for
javax.inject.Named
to activate JSR-330 processing.