2016年5月23日

摘要: Spring bean的几个属性:scope、init-method、destroy-method、depends-on等。 Scope 在Spring容器中是指其创建的Bean对象相对于其他Bean对象的请求可见范围。 scope分类:singleton, prototype, request, 阅读全文
posted @ 2016-05-23 17:05 LarryZeal 阅读(11390) 评论(0) 推荐(0)
摘要: 必须要说的是,父子容器是通过设置形成的关系。 容器实现了 ConfigurableApplicationContext 或 ConfigurableBeanFactory 接口,这两个接口中分别有setParent 及setParentBeanFactory 方法,可以将指定容器设置为当前容器的父容 阅读全文
posted @ 2016-05-23 15:13 LarryZeal 阅读(1689) 评论(0) 推荐(0)
摘要: Spring容器中bean的id或name,都可以有多个,且第一个为标识符(Qualifier),其余皆为别名(Alias)。所以都可以通过applicationContext.getBean("id or name", Type.class)获取。 如果同时存在id和name,则name为别名!! 阅读全文
posted @ 2016-05-23 14:33 LarryZeal 阅读(638) 评论(2) 推荐(0)

导航