摘要: 首先说一下什么是依赖注入,刚开始接触spring的时候不理解;现在根据初步理解,依赖注入,就是将xml文件中设置的属性值,注入到类的实例化对象中! 下面介绍spring的依赖注入 一、set注入 二、构造函数注入 下面的代码展示了这两种注入方式,注意 将set注入,注释掉可以正常执行;将构造函数注释 阅读全文
posted @ 2015-10-26 22:01 沙中世界 阅读(290) 评论(0) 推荐(0)
摘要: import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; public class Test... 阅读全文
posted @ 2015-10-26 21:19 沙中世界 阅读(2181) 评论(0) 推荐(0)