org.springframework.beans.factory.config.Scope
或者,我可以使用特定的带@Scope
注释的注释来绑定接口的自定义实现吗?
例如,我自定义了一个新的作用域类型:
@javax.inject.Scope @Retention(RUNTIME)
@interface Conversation {}
class ConversationScope implements Scope { ... }
class ConversationScopeConfigurer extends BeanFactoryPostProcessor
{ beanFactory.registerScope("conversation", new ConversationScope()); }
现在我想用它作为,
@Component
@Conversation
class Topic { ... }
代替,
@Component
@org.springframework.context.annotation.Scope("conversation")
class Topic { ... }
是否可以?
spring-context 中是否有类似“AnnotationPostProcessor”的东西?