一、

1.

As you can see, a bean factory performs several setup steps before a bean is ready to
use. Let’s break down figure 1.5 in more detail:
1 Spring instantiates the bean.
2 Spring injects values and bean references into the bean’s properties.
3 If the bean implements BeanNameAware , Spring passes the bean’s ID to the set-
BeanName() method.
4 If the bean implements BeanFactoryAware , Spring calls the setBeanFactory()
method, passing in the bean factory itself.
5 If the bean implements ApplicationContextAware , Spring calls the set-
ApplicationContext() method, passing in a reference to the enclosing appli-
cation context.
6 If the bean implements the BeanPostProcessor interface, Spring calls its post-
ProcessBeforeInitialization() method.
7 If the bean implements the InitializingBean interface, Spring calls its after-
PropertiesSet() method. Similarly, if the bean was declared with an init-
method , then the specified initialization method is called.
8 If the bean implements BeanPostProcessor , Spring calls its postProcess-
AfterInitialization() method.
9 At this point, the bean is ready to be used by the application and remains in the
application context until the application context is destroyed.
10 If the bean implements the DisposableBean interface, Spring calls its
destroy() method. Likewise, if the bean was declared with a destroy-method ,
the specified method is called.

SPRING IN ACTION 第4版笔记-第一章-005-Bean的生命周期的更多相关文章

  1. SPRING IN ACTION 第4版笔记-第一章-003-AOP介绍

    一.目标 要在BraveKnight调用embarkOnQuest()前后各做一些处理(调用Minstrel的方法) 二. 1.minstrel.xml <?xml version=" ...

  2. Spring In Action 第4版笔记-第一章-001架构

    1.Spring’s fundamental mission: Spring simplifies Java development. 2.To back up its attack on Java ...

  3. SPRING IN ACTION 第4版笔记-第一章-004-用类来管理DI

    一. 1. package chapter01.sia.knights.config; import org.springframework.context.annotation.Bean; impo ...

  4. SPRING IN ACTION 第4版笔记-第一章-002-DI介绍

    一. 1.knight.xml <?xml version="1.0" encoding="UTF-8"?> <beans xmlns=&qu ...

  5. Android开发艺术探索笔记——第一章:Activity的生命周期和启动模式

    Android开发艺术探索笔记--第一章:Activity的生命周期和启动模式 怀着无比崇敬的心情翻开了这本书,路漫漫其修远兮,程序人生,为自己加油! 一.序 作为这本书的第一章,主席还是把Activ ...

  6. SPRING IN ACTION 第4版笔记-第九章Securing web applications-011-把敏感信息请求转为https(requiresChannel())

    1.把包含敏感信息的请求转为https请求,则较为安全,但如何只把有需要安全的请求转为https,而不是不加分辩就把所有请求都转为https呢?可以用requiresChannel() @Overri ...

  7. SPRING IN ACTION 第4版笔记-第九章Securing web applications-010-拦截请求

    一. What if you wanted to restrict access to certain roles only on Tuesday? Using the access() method ...

  8. SPRING IN ACTION 第4版笔记-第九章Securing web applications-008-使用非关系型数据库时如何验证用户(自定义UserService)

    一. 1.定义接口 Suppose that you need to authenticate against users in a non-relational database suchas Mo ...

  9. SPRING IN ACTION 第4版笔记-第九章Securing web applications-007-设置LDAP server比较密码(contextSource、root()、ldif()、)

    一.LDAP server在哪 By default, Spring Security’s LDAP authentication assumes that the LDAP server is li ...

随机推荐

  1. hibernate篇章一

    我只想说一句话FUCK! 昨晚查了一晚上资料. 今早细致勃勃的准备搭建环境,早上到现在失败!失败!失败!蛋疼 有兴趣的可以试试.我暂时搁置,去做分页了 有兴趣需要相关资料的可以查阅我的微博java66 ...

  2. asp.net:验证控件中ValidationExpression的写法

    手机号:"\d{11}"传真号:"\d{7,12}" EMAIL: ".{2,15}@.{2,15}\..{2,4}" 邮箱正则表达式:/^ ...

  3. bzoj2732: [HNOI2012]射箭 半平面交

    这题乍一看与半平面交并没有什么卵联系,然而每个靶子都可以转化为两个半平面. scanf("%lf%lf%lf",&x,&ymin,&ymax); 于是乎就有 ...

  4. 关于C++对汉字拼音的处理(2)

    对于前面获取字符串汉字全拼音的功能,大家应该有个了解了.现在我又综合广大网友流传的获取字符串汉字拼音首字母的功能进行了整理.介绍如下 这个功能写的稍微有点复杂 使用3个函数解决了获取字符串汉字首拼音串 ...

  5. 九度0J 1374 所有员工年龄排序

    题目地址:http://ac.jobdu.com/problem.php?pid=1374 题目描述: 公司现在要对所有员工的年龄进行排序,因为公司员工的人数非常多,所以要求排序算法的效率要非常高,你 ...

  6. EIGamal密码体制

    EIGamal密码体制:由EIGamal提出,是一种基于离散对数问题的双钥密码体制,既可用于加密,又可以用于签名. 密钥对生成步骤: 1.取大素数p和g<p(g最好是p的素根) 2.选一整数x& ...

  7. SQL Server系统视图 [不定期更新]

    1.sys.objects:在数据库中创建的每个用户定义的架构作用域内的对象(如表.视图.约束.默认值.日志.规则存储过程等,但不包括DDL触发器)在该表中均对应一行. 列名 说明 name 对象名. ...

  8. .net日志专用

    一个简单的.net写日志方法 - 可能的改进点 昨天有个朋友在评论的时候问我如下代码在web开发中有什么问题 public void Log(string msg) { System.IO.File. ...

  9. 高效的VS调试技巧

    本文总结了十个调试技巧,当你使用VS的时候可以节省你很多时间. 1.悬停鼠标查看表达式 调试有时候很有挑战性,当你步入一个函数想看看哪块出错的时候,查看调用栈来想想值是从哪来的.另一些情况下,则需要添 ...

  10. Log4j 密码屏蔽

    Log4j filter to mask Payment Card numbers (PCI DSS) According to PCI DSS (Payment Card Industry Data ...