如何设置Spring会话范围bean的属性名称?

ams*_*ams 10 spring spring-mvc spring-webflow

给定一个配置了会话范围的spring bean,例如:

@Component
@Scope(proxyMode=ScopedProxyMode.TARGET_CLASS,value=WebApplicationContext.SCOPE_SESSION)
public class SomeBean {
}
Run Code Online (Sandbox Code Playgroud)

有没有办法控制Spring在http会话中存储bean的名称?

默认情况下,使用会话密钥scopedTarget.someBean的弹簧接缝是否可以添加到注释中以在Session中显式指定属性名称?

Jon*_*han 4

我会用:

@Component (value="mySpecialName")
@Scope (value="session")
Run Code Online (Sandbox Code Playgroud)