java - sprin加载完xml,初始化好bean之后,怎么保证初始化好的bean始终被引用的,也就是说怎么保证不被垃圾回收机制回收
PHPz
PHPz 2017-04-18 09:32:36
0
2
330
PHPz
PHPz

学习是最好的投资!

reply all(2)
伊谢尔伦

You can simplify spring:

//简化成下面这样,具体可以去看spring源码
Map<String, Object> applicationContext

In the default Singleton mode, after loading the xml, the instantiated object has been referenced by the ApplicationContext and will not be recycled during the spring life cycle

伊谢尔伦

Initialized beans are maintained in a map, and this map is final修饰,这样map就作为了一个GC ROOT对象,jvm采用的可达性分析算法

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!