Spring 3.0 Disable @Inject Annotation Processing
Is there a way to disable the @Inject
annotation processing of spring 3.0?
I'm trying to use the CDI @Conversation
Scope t开发者_开发百科ogether with spring, but when it comes to
@Inject
private Conversation conversation;
spring tries to autowire the conversation which obviously failed.
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
:
@Configuration
@ComponentScan(excludeFilters = {@Filter(Named.class)})
public class SpringConfig
{
}
or disable default filters something like:
@Configuration
@ComponentScan(useDefaultFilters = false, includeFilters = {@Filter(Component.class)})
public class SpringConfig
{
}
This works because Spring sets by default an include filter for javax.inject.Named
to activate JSR-330 processing.
I don't think you can. But spring has its own conversation support - take a look at spring web flow.
精彩评论