@@ -3958,10 +3958,10 @@ integration interfaces.
3958
3958
=== Customizing Beans by Using a `BeanPostProcessor`
3959
3959
3960
3960
The `BeanPostProcessor` interface defines callback methods that you can implement to
3961
- provide your own (or override the container's default) instantiation logic,
3962
- dependency- resolution logic, and so forth. If you want to implement some custom logic
3963
- after the Spring container finishes instantiating, configuring, and initializing a bean,
3964
- you can plug in one or more `BeanPostProcessor` implementations.
3961
+ provide your own (or override the container's default) instantiation logic, dependency
3962
+ resolution logic, and so forth. If you want to implement some custom logic after the
3963
+ Spring container finishes instantiating, configuring, and initializing a bean, you can
3964
+ plug in one or more custom `BeanPostProcessor` implementations.
3965
3965
3966
3966
You can configure multiple `BeanPostProcessor` instances, and you can control the order
3967
3967
in which these `BeanPostProcessor` instances execute by setting the `order` property.
@@ -3975,13 +3975,13 @@ registration of `BeanPostProcessor` instances>>.
3975
3975
3976
3976
[NOTE]
3977
3977
====
3978
- `BeanPostProcessor` instances operate on bean (or object) instances. That is, the
3979
- Spring IoC container instantiates a bean instance and then `BeanPostProcessor` instances do
3980
- their work.
3978
+ `BeanPostProcessor` instances operate on bean (or object) instances. That is,
3979
+ the Spring IoC container instantiates a bean instance and then `BeanPostProcessor`
3980
+ instances do their work.
3981
3981
3982
3982
`BeanPostProcessor` instances are scoped per-container. This is relevant only if you
3983
- use container hierarchies. If you define a `BeanPostProcessor` in one container, it
3984
- post-processes only the beans in that container. In other words, beans that are
3983
+ use container hierarchies. If you define a `BeanPostProcessor` in one container,
3984
+ it post-processes only the beans in that container. In other words, beans that are
3985
3985
defined in one container are not post-processed by a `BeanPostProcessor` defined in
3986
3986
another container, even if both containers are part of the same hierarchy.
3987
3987
@@ -3994,12 +3994,12 @@ The `org.springframework.beans.factory.config.BeanPostProcessor` interface consi
3994
3994
exactly two callback methods. When such a class is registered as a post-processor with
3995
3995
the container, for each bean instance that is created by the container, the
3996
3996
post-processor gets a callback from the container both before container
3997
- initialization methods (such as `InitializingBean.afterPropertiesSet()`, after any
3997
+ initialization methods (such as `InitializingBean.afterPropertiesSet()` or any
3998
3998
declared `init` method) are called, and after any bean initialization callbacks.
3999
3999
The post-processor can take any action with the bean instance, including ignoring the
4000
- callback completely. A bean post-processor typically checks for callback interfaces, or it
4001
- may wrap a bean with a proxy. Some Spring AOP infrastructure classes are implemented as
4002
- bean post-processors in order to provide proxy-wrapping logic.
4000
+ callback completely. A bean post-processor typically checks for callback interfaces,
4001
+ or it may wrap a bean with a proxy. Some Spring AOP infrastructure classes are
4002
+ implemented as bean post-processors in order to provide proxy-wrapping logic.
4003
4003
4004
4004
An `ApplicationContext` automatically detects any beans that are defined in the
4005
4005
configuration metadata that implements the `BeanPostProcessor` interface. The
@@ -4018,27 +4018,27 @@ initialization of other beans in the context, this early type detection is criti
4018
4018
[[beans-factory-programmatically-registering-beanpostprocessors]]
4019
4019
.Programmatically registering `BeanPostProcessor` instances
4020
4020
NOTE: While the recommended approach for `BeanPostProcessor` registration is through
4021
- `ApplicationContext` auto-detection (as described earlier), you can
4022
- register them programmatically against a `ConfigurableBeanFactory` by using the
4023
- `addBeanPostProcessor` method. This can be useful when you need to evaluate conditional
4024
- logic before registration or even for copying bean post processors across contexts in a
4025
- hierarchy. Note, however, that `BeanPostProcessor` instances added programmatically do not
4026
- respect the `Ordered` interface. Here, it is the order of registration that
4027
- dictates the order of execution. Note also that `BeanPostProcessor` instances registered
4028
- programmatically are always processed before those registered through auto-detection,
4029
- regardless of any explicit ordering.
4021
+ `ApplicationContext` auto-detection (as described earlier), you can register them
4022
+ programmatically against a `ConfigurableBeanFactory` by using the `addBeanPostProcessor`
4023
+ method. This can be useful when you need to evaluate conditional logic before
4024
+ registration or even for copying bean post processors across contexts in a hierarchy.
4025
+ Note, however, that `BeanPostProcessor` instances added programmatically do not respect
4026
+ the `Ordered` interface. Here, it is the order of registration that dictates the order
4027
+ of execution. Note also that `BeanPostProcessor` instances registered programmatically
4028
+ are always processed before those registered through auto-detection, regardless of any
4029
+ explicit ordering.
4030
4030
4031
4031
.`BeanPostProcessor` instances and AOP auto-proxying
4032
4032
[NOTE]
4033
4033
====
4034
4034
Classes that implement the `BeanPostProcessor` interface are special and are treated
4035
- differently by the container. All `BeanPostProcessor` instances and beans that they directly reference
4036
- are instantiated on startup, as part of the special startup phase of the
4037
- `ApplicationContext`. Next, all `BeanPostProcessor` instances are registered in a sorted fashion
4038
- and applied to all further beans in the container. Because AOP auto-proxying is
4039
- implemented as a `BeanPostProcessor` itself, neither `BeanPostProcessor` instances nor the beans
4040
- they directly reference are eligible for auto-proxying and, thus, do not have aspects
4041
- woven into them.
4035
+ differently by the container. All `BeanPostProcessor` instances and beans that they
4036
+ directly reference are instantiated on startup, as part of the special startup phase
4037
+ of the `ApplicationContext`. Next, all `BeanPostProcessor` instances are registere
4038
+ in a sorted fashion and applied to all further beans in the container. Because AOP
4039
+ auto-proxying is implemented as a `BeanPostProcessor` itself, neither `BeanPostProcessor`
4040
+ instances nor the beans they directly reference are eligible for auto-proxying and,
4041
+ thus, do not have aspects woven into them.
4042
4042
4043
4043
For any such bean, you should see an informational log message: `Bean someBean is not
4044
4044
eligible for getting processed by all BeanPostProcessor interfaces (for example: not
0 commit comments