71

Spring的依赖注入-zero

 6 years ago
source link: http://blog.51cto.com/zero01/2073451
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
所谓依赖注入就是在创建一个对象时,将这个对象所依赖的对象或数据都创建好放进去,例如有一个Student类,它的构造器要求传递一个Dog对象,也就是说它依赖这个Dog对象,或者它有一个String类型的属性,那么它也就依赖String类型的数据。通过Spring的配置文件,我们可以配置好某个对象的依赖,当该对象被实例化时一并将它的依赖创建好给它,这个过程就是依赖注入。在Spring的配置文件中,我们

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK