Spring 的 BeanPostProcessor
来源:互联网 发布:小熊棋牌源码 编辑:程序博客网 时间:2024/05/20 07:54
主要作用是在 bean 的生命周期加入自己的代码,注意这个代码是多 context 里面所有的 bean 生效,
但可以根据beanName来过滤只对自己需要的bean实现额外的初始化或初始化后的操作。
postProcessAfterInitialization(Object bean, String beanName);
postProcessBeforeInitialization(Object bean, String beanName);
Spring in Action 2.4.1 也讲了,看一下就明白了。
跟BeanPostProcessor有关的是使用Auto-Proxy Creator来配置AOP
<!-- Create the proxy bean that returns AOP'd varieties of our controller -->
<bean name="proxyCreator" class="org.springframework.aop.autoproxy.BeanNameAutoProxyCreator">
<property name="beanNames" value="*Controller"/>
<property name="interceptorNames">
<list>
<value>beforeAdviceA</value>
<value>interceptorA</value>
</list>
</property>
</bean>
<bean name="beforeAdvisor" class="com.javalobby.tnt.spring.aop.BeforMethodAdvisor"/>
<bean name="afterAdvisor" class="com.javalobby.tnt.spring.aop.AfterMethodAdvisor" />
现在看来Auto-Proxy Creator只是一个简化配置
Auto-Proxy Creator Resource:
http://www.javalobby.org/java/forums/t45333.html- Spring 的 BeanPostProcessor
- Spring 的 BeanPostProcessor接口实现
- Spring 的 BeanPostProcessor接口实现
- Spring 的 BeanPostProcessor接口实现
- Spring 的 BeanPostProcessor接口实现
- Spring 的 BeanPostProcessor接口实现
- Spring的BeanFactoryPostProcessor和BeanPostProcessor
- Spring 的 BeanPostProcessor接口实现
- Spring 的 BeanPostProcessor接口实现
- Spring 的 BeanPostProcessor接口实现
- Spring 的 BeanPostProcessor接口实现
- Spring的BeanFactoryPostProcessor和BeanPostProcessor
- Spring的BeanFactoryPostProcessor和BeanPostProcessor
- Spring的BeanFactoryPostProcessor和BeanPostProcessor
- Spring 的 BeanPostProcessor接口实现
- Spring的BeanFactoryPostProcessor和BeanPostProcessor
- Spring的BeanFactoryPostProcessor和BeanPostProcessor
- Spring的BeanFactoryPostProcessor和BeanPostProcessor
- 转贴 [译].NET委托:一个C#睡前故事
- Function bytes2BSTR(vIn)
- js中的小技巧(转帖)
- 嵌入式文件系统小结
- 埃及艳后的鸡蛋美容术 [转]
- Spring 的 BeanPostProcessor
- 一个程序员的奋斗历程
- 全面认识手机扩展卡
- 基于时间戳的缓存构架:最近的数据拥有最佳的性能
- 转贴[译]C#WinForm中实现异形窗体/控件
- IT—Channel系統段工作總結
- 爱不要太深,否则会使自己受到伤害!
- C# WinForm 中在窗口标题栏上加按钮 [转贴]
- 用 Visual Studio 2005 实现用户界面自动化测试