BeanFactoryPostProcessor vs BeanPostProcessor
BeanFactoryPostProcessors affect BeanDefinition objects because they are run right after your configuration is read in.There are no bean instances created yet.
So it can’t do anything to your objects instances yet. For Example the PropertyPlaceholderConfigurer is a BeanFactoryPostProcessor, which looks through the
BeanDefinition objects and replaces any ${property.name} with the actual value of property.name from a Properties file, or System.getProperty() or environment variables.
例如:
PropertyPlaceholderConfigurer
EntityManagerBeanDefinitionRegistrarPostProcessor
BeanPostProcessors affect instances of your objects.
For example here is where Spring AOP decides to create proxies for your beans.
So you declare transactions or AOP Aspect JoinPoints to run code when certain methods are called on your beans.
Well how is Spring going to add that “Code” to your code. It uses proxies. So when you call your business logic method, you want it to start a transaction.
So in the BeanPostProcessing phase, Spring will see that you defined transactions on that method, it will create a Proxy object and wrap it around your actual
bean instance, and it will put the Proxy object into the ApplicationContext/BeanFactory’s HashMap under the beans name.
So now when you call getBean() what you get back isn’t the actual Bean Instance, but the Proxy instead that holds the actual bean Instance.
Without the BeanPostProcessor phase, Spring would not be able to do that.
出处:
BeanFactoryPostProcessor vs BeanPostProcessor
深入Spring Boot:那些注入不了的 Spring 占位符
BeanFactoryPostProcessor vs BeanPostProcessor的更多相关文章
- spring 后置处理器BeanFactoryPostProcessor和BeanPostProcessor的用法和区别
主要区别就是: BeanFactoryPostProcessor可以修改BEAN的配置信息而BeanPostProcessor不能,下面举个例子说明 BEAN类: package com.spring ...
- Spring的BeanFactoryPostProcessor和BeanPostProcessor
转载:http://blog.csdn.net/caihaijiang/article/details/35552859 BeanFactoryPostProcessor和BeanPostProces ...
- Spring点滴十一:Spring中BeanFactoryPostProcessor和BeanPostProcessor区别
Spring中BeanFactoryPostProcessor和BeanPostProcessor都是Spring初始化bean时对外暴露的扩展点.两个接口从名字看起来很相似,但是作用及使用场景却不同 ...
- spring扩展点之一:BeanFactoryPostProcessor和BeanPostProcessor
一.BeanFactoryPostProcessor和BeanPostProcessor的区别 BeanFactoryPostProcessor和BeanPostProcessor都是spring初始 ...
- BeanFactoryPostProcessor和BeanPostProcessor
1. BeanFactoryPostProcessor调用(见AbstractApplicationContext.refresh): >> 创建DefaultListableBeanFa ...
- Spring Boot源码(五):BeanFactoryPostProcessor和BeanPostProcessor
BeanFactoryPostProcessor是spring BeanFactory加载Bean后调用, BeanPostProcessor是Bean初始化前后调用. BeanFactoryPost ...
- Spring 钩子之BeanFactoryPostProcessor和BeanPostProcessor的源码学习,FactoryBean
BeanFactoryPostProcessor 是用于增强BeanFactory的(例如可以增强beanDefination), BeanPostProcessor是用于增强bean的,而Facto ...
- spring BeanPostProcessor
BeanPostProcessor spring使用BeanPostProcessor接口来处理生命周期的回调 BeanPostProcessor接口定义的两个方法,分别在bean的(实例化配置和初始 ...
- 简单比较init-method,afterPropertiesSet和BeanPostProcessor
一.简单介绍 1.init-method方法,初始化bean的时候执行,可以针对某个具体的bean进行配置.init-method需要在applicationContext.xml配置文档中bean的 ...
随机推荐
- Image Lazy Load:那些延时加载图片的开源插件(jQuery)
图片延时加载技术对大流量的网站来说是十分实用的.目前图片在网站中大量使用,如果不加处理的话会对服务器和带宽造成级大压力,通过只渲染当前用户可见区域的图片,可以极大地减少网站的请求数,降低网络带宽资源. ...
- MySQL5.7.19 服务挂掉 自动关闭 mysqld got exception 0xc000001d win 2008R2
在mysql 官网看到mysqld got exception 0xc000001dThis error message occurs because you are also using a CPU ...
- 纯CSS3冒泡动画按钮实现教程
这款CSS3动画按钮非常的有创意,鼠标在滑过按钮时并不像其他按钮那样仅仅改变按钮的背景颜色,而是出现很酷的冒泡动画.这么惊艳的CSS3动画按钮,这篇文章主要将按钮实现的过程和代码分享给大家,希望能给在 ...
- Javascript Base64加密解密代码
<script language="javascript" runat="server"> var keyStr = "ABCDEFGHI ...
- DedeCMS织梦文章页图片地址为绝对路径实现方法
{dede:field.body function='replaceurl(@me)'/} 余斗博客改版后增加了一个m站点即手机站点,用二级域名实现,在做手机站的过程中发现一个问题,手机站和pc站都是 ...
- 关于tomcat7服务下面js无法获取JSESSIONID的cookie信息
http://tomcat.apache.org/tomcat-5.5-doc/config/context.html Does anyone know what changed in the con ...
- 网络编程 -- RPC实现原理 -- NIO单线程
网络编程 -- RPC实现原理 -- 目录 啦啦啦 Class : Service package lime.pri.limeNio.optimize.socket; import java.io.B ...
- flask下载文件中文IE,Edge,Safari文件名乱码
flask(0.11.2)+python3.6 兼容各个主流浏览器,已经过各种测试(chrome,firefox,safari,IE,Edge) quote是将文件名urlencode化,然后以适应E ...
- POJ 3635 - Full Tank? - [最短路变形][优先队列优化Dijkstra]
题目链接:http://poj.org/problem?id=3635 Description After going through the receipts from your car trip ...
- [No0000D0] 让你效率“猛增十倍”,沉浸工作法到底是什么?
一位编剧在三天内完成两万字的剧本,而在此之前,他曾拖延了足足半年.一名大四学生用一天半写了8000多字,一鼓作气拿下毕业论文. 有人说:“用了这个方法,我的效率猛增十倍.只用短短两小时,就摧枯拉朽地完 ...