文档章节

spring 的那些 processors

why_Dk37
 why_Dk37
发布于 2016/12/11 16:45
字数 349
阅读 23
收藏 0

spring笔记

spring 的那些 processors

BeanFactoryPostProcessor Allows for custom modification of an application context's bean definitions, adapting the bean property values of the context's underlying bean factory.

Application contexts can auto-detect BeanFactoryPostProcessor beans in their bean definitions and apply them before any other beans get created.

Useful for custom config files targeted at system administrators that override bean properties configured in the application context.

eg. PropertyPlaceholderConfigurer PropertySourcesPlaceholderConfigurer This class is designed as a general replacement for {@code PropertyPlaceholderConfigurer} in Spring 3.1 applications. It is used by default to support the {@code property-placeholder} element in working against the spring-context-3.1 XSD, whereas spring-context versions <= 3.0 default to {@code PropertyPlaceholderConfigurer} to ensure backward compatibility. See spring-context XSD documentation for complete details.

As of Spring 3.1, PropertySourcesPlaceholderConfigurer should be used preferentially over this implementation;

BeanPostProcessor Factory hook that allows for custom modification of new bean instances, e.g. checking for marker interfaces or wrapping them with proxies.

ApplicationContexts can autodetect BeanPostProcessor beans in their bean definitions and apply them to any beans subsequently created. Plain bean factories allow for programmatic registration of post-processors, applying to all beans created through this factory.

<p>Typically, post-processors that populate beans via marker interfaces or the like will implement {[@link](https://my.oschina.net/u/393) #postProcessBeforeInitialization}, while post-processors that wrap beans with proxies will normally implement {[@link](https://my.oschina.net/u/393) #postProcessAfterInitialization}.

DestructionAwareBeanPostProcessor Subinterface of {@link BeanPostProcessor} that adds a before-destruction callback.

he typical usage will be to invoke custom destruction callbacks on specific bean types, matching corresponding initialization callbacks.

InstantiationAwareBeanPostProcessor Subinterface of {@link BeanPostProcessor} that adds a before-instantiation callback, and a callback after instantiation but before explicit properties are set or autowiring occurs.

Typically used to suppress default instantiation for specific target beans, for example to create proxies with special TargetSources (pooling targets, lazily initializing targets, etc), or to implement additional injection strategies such as field injection.

BeanDefinitionRegistryPostProcessor

public interface BeanDefinitionRegistryPostProcessor extends BeanFactoryPostProcessor

Extension to the standard {@link BeanFactoryPostProcessor} SPI, allowing for the registration of further bean definitions <i>before</i> regular BeanFactoryPostProcessor detection kicks in. In particular, BeanDefinitionRegistryPostProcessor may register further bean definitions which in turn define BeanFactoryPostProcessor instances.

© 著作权归作者所有

共有 人打赏支持
why_Dk37
粉丝 1
博文 22
码字总数 17584
作品 0
海淀
程序员
spring 的那些 processors

spring笔记 spring 的那些 processors BeanFactoryPostProcessorAllows for custom modification of an application context's bean definitions,adapting the bean property values of the ......

why_Dk37
2016/10/15
4
0
聊聊spring cloud gateway的NettyConfiguration

序 本文主要研究下spring cloud gateway的NettyConfiguration NettyConfiguration spring cloud gateway使用的是reactor的httpclient,其通过nettyClientOptions这个bean来进行构造options,......

go4it
06/03
0
0
Dubbo源码-Dubbo是如何随心所欲自定义XML标签的

叨叨 今天考虑了很久要不要写这篇文章。 距离《Dubbo源码》系列的开篇到现在已经快两个月时间了。当时是想着工作上的RPC框架使用存在一些让人头疼的问题,就来看看Dubbo给出了一套什么样的解...

Jackie_Zheng
05/20
0
0
spring ioc注解 IOC

@Autowired 1、Spring 通过一个 BeanPostProcessor 对 @Autowired 进行解析,所以要让 @Autowired 起作用必须事先在 Spring 容器中声明 AutowiredAnnotationBeanPostProcessor Bean。 Java代...

五大三粗
2015/11/02
0
0
spring mvc 中一些特殊的类

涉及到一些spring mvc 的设计 关键类赋予特别的关心 Table 16.1. Special bean types in the WebApplicationContext Bean type Explanation HandlerMapping Maps incoming requests to handl......

triankg
2014/06/19
0
0

没有更多内容

加载失败,请刷新页面

加载更多

下一页

SpringCloud SpringBoot mybatis分布式Web应用的统一异常处理

我们在做Web应用的时候,请求处理过程中发生错误是非常常见的情况。Spring Boot提供了一个默认的映射:/error,当处理中抛出异常之后,会转到该请求中处理,并且该请求有一个全局的错误页面用...

itcloud
9分钟前
0
0
c++ std::bind和std::function

定义于头文件 <functional> std::bind 函数绑定,https://zh.cppreference.com/w/cpp/utility/functional/bind // bind 用例#include <iostream>#include <functional> // 自定义的一......

SibylY
12分钟前
0
0
SecureCRT的安装与破解(过程很详细!!!)

SecureCRT的安装与破解(过程很详细!!!) SecureCRT的安装与破解(过程很详细!!!) 使用SecureCRT可以方便用户在windows环境下对linux主机进行管理,这里为大家讲一下SecureCRT的破解方...

DemonsI
16分钟前
0
0
介绍几款可用的web应用防火墙

目前有两款,基于软件和基于应用程序的web应用防火墙。基于软件的产品布置在Web服务器上,而基于应用程序的产品放置在Web服务器和互联网接口之间。两种类型的防火墙都会在数据传入和传出web...

上树的熊
23分钟前
1
0
用Visual Studio开发以太坊智能合约

区块链和以太坊 自从我熟悉区块链、以太坊和智能合约以来,一直失眠。 我一直在阅读,阅读和阅读,最后我能够使用一些工具,他们建议使用以太坊网站官方客户端应用程序(Ethereum Wallet)也...

geek12345
25分钟前
1
0

没有更多内容

加载失败,请刷新页面

加载更多

下一页

返回顶部
顶部