摘要: 1,singleton Spring ioc 容器中仅有一个Bean 实例,Bean 以单例的方式存在;2,prototype 每次从容器中调用Bean 时,都返回一个新的实例;3,request 每次HTTP 请求都会创建一个新的Bean;4,session 同一个HTTP Session 共享一... 阅读全文
posted @ 2015-05-16 21:16 肉球 阅读(169) 评论(0) 推荐(0) 编辑
摘要: 1,继承;2,依赖;3,引用;package entity;public class Dog { private String name; public String getName() { return name; } public void setName(... 阅读全文
posted @ 2015-05-16 21:13 肉球 阅读(237) 评论(0) 推荐(0) 编辑
摘要: 通过配置default-autowire 属性,Spring IOC 容器可以自动为程序注入bean;默认是no,不启用自动装配;default-autowire 的类型有byName,byType,constructor;byName:通过名称进行自动匹配;byType:根据类型进行自动匹配;co... 阅读全文
posted @ 2015-05-16 21:01 肉球 阅读(1461) 评论(0) 推荐(0) 编辑
摘要: 注入参数:1,基本类型值;2,注入bean;3,内部bean;4,null 值;5,级联属性;6,集合类型属性;package entity;public class Dog { private String name; public String getName() { ... 阅读全文
posted @ 2015-05-16 20:01 肉球 阅读(302) 评论(0) 推荐(0) 编辑
摘要: spring ioc:控制反转,或叫依赖注入简单的bean装配:import org.springframework.context.ApplicationContext;import org.springframework.context.support.ClassPathXmlApplicati... 阅读全文
posted @ 2015-05-16 19:54 肉球 阅读(169) 评论(0) 推荐(0) 编辑