1
我想创建一个singleton birt对象,因为birt对象是重量很大的对象,我对这个技术是新的,所以任何帮助都会被修改。如何在spring中创建birt运行时对象作为singleton
我想创建一个singleton birt对象,因为birt对象是重量很大的对象,我对这个技术是新的,所以任何帮助都会被修改。如何在spring中创建birt运行时对象作为singleton
此对象在应用方面使用singleton scope:
<bean id="accountController" class="com.foo.DefaultAccountController" />
<!-- (singleton scope is the default) -->
<bean id="accountService" class="com.foo.DefaultAccountService" />
然后你就可以自动装配在像这样的一些声明豆依赖性:
public class DefaultAccountController {
@Autowired
private DefaultAccountService accService;
...
}
详细信息可以在Spring documentation找到。
如何将该对象传递给其他类。 – user3060230
@ user3060230我更新了答案 – injecto