aop的Spring JavaConfig:作用域代理
JavaConfig与此等价的是什么aop的Spring JavaConfig:作用域代理,spring,Spring,JavaConfig与此等价的是什么 <!-- an HTTP Session-scoped bean exposed as a proxy that acts as session storage. --> <bean id="checkOutCounter" class="org.brightworks.genesis.client.forms.CheckOutCounter" scope="session"> <!-- this next e
<!-- an HTTP Session-scoped bean exposed as a proxy
that acts as session storage.
-->
<bean id="checkOutCounter" class="org.brightworks.genesis.client.forms.CheckOutCounter" scope="session">
<!-- this next element effects the proxying of the surrounding bean -->
<aop:scoped-proxy/>
</bean>
所述xml配置的等价物是什么?用于组件初始化:
@Component
@Scope(value = "session", proxyMode = ScopedProxyMode.INTERFACES)
对于@Bean:
@Bean
@Scope(value="session", proxyMode = ScopedProxyMode.TARGET_CLASS)
public CheckOutCounter checkOutCounter(){
return new CheckOutCounter();
}
DefaultScopes在哪个包下?它只是一个字符串常量。您可以将其替换为
“session”
那么@ScopedProxy呢?由于一些奇怪的原因,scope和ScopedProxy无法导入,我可以知道这两个需要什么jar吗?您的spring版本是什么?
@Bean
@Scope(value="session", proxyMode = ScopedProxyMode.TARGET_CLASS)
public CheckOutCounter checkOutCounter(){
return new CheckOutCounter();
}