From f7cef2ab202f238ae94d90badd071313986af19f Mon Sep 17 00:00:00 2001 From: Sam Brannen Date: Tue, 23 Feb 2021 16:21:07 +0100 Subject: [PATCH] Remove section on RequiredAnnotationBeanPostProcessor in ref docs In order to reduce the focus on the deprecated @Required support, this commit removes the RequiredAnnotationBeanPostProcessor section and replaces it with a TIP and an updated NOTE. See gh-26578 --- src/docs/asciidoc/core/core-beans.adoc | 31 +++++++++++--------------- 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/src/docs/asciidoc/core/core-beans.adoc b/src/docs/asciidoc/core/core-beans.adoc index 38b6a1b9fd4..84ee7990c50 100644 --- a/src/docs/asciidoc/core/core-beans.adoc +++ b/src/docs/asciidoc/core/core-beans.adoc @@ -4325,20 +4325,6 @@ Spring's `AutowiredAnnotationBeanPostProcessor` -- a `BeanPostProcessor` impleme that ships with the Spring distribution and autowires annotated fields, setter methods, and arbitrary config methods. -[[beans-factory-extension-bpp-examples-rabpp]] -==== Example: The `RequiredAnnotationBeanPostProcessor` - -Spring's `RequiredAnnotationBeanPostProcessor` is a `BeanPostProcessor` implementation -that ships with the Spring distribution and that ensures that JavaBean properties on -beans that are marked with an (arbitrary) annotation are actually (configured to be) -dependency-injected with a value. - -[NOTE] -==== -The `RequiredAnnotationBeanPostProcessor` is formally deprecated as of Spring Framework -5.1. See note in the section on <> for details. -==== - [[beans-factory-extension-factory-postprocessors]] @@ -4698,12 +4684,21 @@ instances or the like later on. We still recommend that you put assertions into bean class itself (for example, into an init method). Doing so enforces those required references and values even when you use the class outside of a container. +[TIP] +==== +The {api-spring-framework}/beans/factory/annotation/RequiredAnnotationBeanPostProcessor.html[`RequiredAnnotationBeanPostProcessor`] +must be registered as a bean to enable support for the `@Required` annotation. Note, +however, that a `RequiredAnnotationBeanPostProcessor` bean is registered automatically +when using the `` or `` XML +namespace elements. +==== + [NOTE] ==== -The `@Required` annotation is formally deprecated as of Spring Framework 5.1, in favor of -using constructor injection for required settings (or a custom implementation of -`InitializingBean.afterPropertiesSet()` or a custom `@PostConstruct` method along with -bean property setter methods). +The `@Required` annotation and `RequiredAnnotationBeanPostProcessor` are formally +deprecated as of Spring Framework 5.1, in favor of using constructor injection for +required settings (or a custom implementation of `InitializingBean.afterPropertiesSet()` +or a custom `@PostConstruct` method along with bean property setter methods). ====