[英]Spring session-scoped bean with construtor argument
在Spring中,我有一个bean,如果没有依赖于用户输入的构造函数参数,则不应实例化该bean。 在控制器或另一个Singleton-Scopped bean中实例化SessionScoped bean的正确方法是什么?
public class SingletonScoped{
...
}
public class SessionScoped{
@Autowired
SingletonScoped singletonScopped;
private SessionScoped(){
}
public SessionScoped(Object userInput){
}
}
public class AnotherSingletonScoped{
...
}
基本上我应该在serverlet-context.xml中添加spring参数,然后您可以在此处传递参数。 您可以在这篇文章中看到更多详细信息http://chiase.azurewebsites.net/?p=171
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.