摘要: 1、创建Person类 public class Person { private String name; private Integer age; public Person() { super(); } public Person(String name, Integer age) { sup 阅读全文
posted @ 2020-03-08 15:03 Arbitrary233 阅读(875) 评论(0) 推荐(0)
摘要: 1、创建Bird类并注入容器中 @Component public class Bird { public Bird() { System.out.println("Bird的构造方法执行了"); } //对象构造并属性赋值后执行 @PostConstruct public void PostCon 阅读全文
posted @ 2020-03-08 11:54 Arbitrary233 阅读(304) 评论(0) 推荐(0)
摘要: 1、创建Bird类 @Component public class Bird { public Bird() { System.out.println("Bird的构造方法执行了"); } //对象构造并属性赋值后执行 @PostConstruct public void PostConstruct 阅读全文
posted @ 2020-03-08 11:23 Arbitrary233 阅读(190) 评论(0) 推荐(0)
摘要: 1、创建Tiger类实现InitializingBean,DisposableBean接口,并通过@Component将该组件注入 @Component public class Tiger implements InitializingBean,DisposableBean{ public Tig 阅读全文
posted @ 2020-03-08 11:06 Arbitrary233 阅读(345) 评论(0) 推荐(0)
摘要: 构造(对象创建) * 单实例:在每次容器启动的时候创建对象 * 多实例:在每次获取的时候创建对象初始化: 对象创建完成,并赋值好,调用初始化方法 销毁: 单实例:容器关闭的时候 多实例:容器不会不会管理这个bean的销毁方法 1、创建一个Dog类 public class Dog { public 阅读全文
posted @ 2020-03-08 10:41 Arbitrary233 阅读(2638) 评论(0) 推荐(1)