阅读背景:

初始化bean的最佳方法是什么?

来源:互联网 

In spring you can initialize a bean by having the applicationContext.xml invoke a constructor, or you can set properties on the bean. What are the trade offs between the two approaches? Is it better to have a constructor (which enforces the contract of having everything it needs in one method) or is it better to have all properties (which gives you flexibility to only inject selectively for example when unit testing.)In spring you can initialize a bean by having t




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: