Skip to content

Commit f966bf6

Browse files
committed
Explicitly mention BeanPostProcessor declaration requirements with @bean methods
Issue: SPR-11906
1 parent 779ca99 commit f966bf6

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/asciidoc/index.adoc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4510,6 +4510,14 @@ configuration metadata which implement the `BeanPostProcessor` interface. The
45104510
later upon bean creation. Bean post-processors can be deployed in the container just
45114511
like any other beans.
45124512

4513+
Note that when declaring a ++BeanPostProcessor++ using an `@Bean` factory method on a
4514+
configuration class, the return type of the factory method should be the implementation
4515+
class itself or at least the `org.springframework.beans.factory.config.BeanPostProcessor`
4516+
interface, clearly indicating the post-processor nature of that bean. Otherwise, the
4517+
`ApplicationContext` won't be able to autodetect it by type before fully creating it.
4518+
Since a ++BeanPostProcessor++ needs to be instantiated early in order to apply to the
4519+
initialization of other beans in the context, this early type detection is critical.
4520+
45134521
[NOTE]
45144522
====
45154523

0 commit comments

Comments
 (0)