标签: java spring autowired
可能重复: getting new bean instances of referencing beans every time
每次获取自动装配类的新实例的简单方法是什么?
我已经探索了会话,请求,原型,@resource。似乎没有提供所需的效果。
答案 0 :(得分:2)
使用@Scope("prototype")
@Scope("prototype")
@Service @Scope("prototype") public class YourService{}