Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
aop的Spring JavaConfig:作用域代理_Spring - Fatal编程技术网

aop的Spring 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

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 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();
}