diff --git a/org.springframework.beans/src/main/java/org/springframework/beans/factory/annotation/AutowiredAnnotationBeanPostProcessor.java b/org.springframework.beans/src/main/java/org/springframework/beans/factory/annotation/AutowiredAnnotationBeanPostProcessor.java index 78538586930..52cf15866a8 100644 --- a/org.springframework.beans/src/main/java/org/springframework/beans/factory/annotation/AutowiredAnnotationBeanPostProcessor.java +++ b/org.springframework.beans/src/main/java/org/springframework/beans/factory/annotation/AutowiredAnnotationBeanPostProcessor.java @@ -90,7 +90,10 @@ import org.springframework.util.ReflectionUtils; * by the "context:annotation-config" and "context:component-scan" XML tags. * Remove or turn off the default annotation configuration there if you intend * to specify a custom AutowiredAnnotationBeanPostProcessor bean definition. - * + *

NOTE: Annotation injection will be performed before XML injection; thus + * the latter configuration will override the former for properties wired through + * both approaches. + * * @author Juergen Hoeller * @author Mark Fisher * @since 2.5 diff --git a/org.springframework.context/src/main/java/org/springframework/context/annotation/CommonAnnotationBeanPostProcessor.java b/org.springframework.context/src/main/java/org/springframework/context/annotation/CommonAnnotationBeanPostProcessor.java index 1e4495d1aff..d981c811a5c 100644 --- a/org.springframework.context/src/main/java/org/springframework/context/annotation/CommonAnnotationBeanPostProcessor.java +++ b/org.springframework.context/src/main/java/org/springframework/context/annotation/CommonAnnotationBeanPostProcessor.java @@ -124,6 +124,9 @@ import org.springframework.util.StringUtils; * by the "context:annotation-config" and "context:component-scan" XML tags. * Remove or turn off the default annotation configuration there if you intend * to specify a custom CommonAnnotationBeanPostProcessor bean definition! + *

NOTE: Annotation injection will be performed before XML injection; thus + * the latter configuration will override the former for properties wired through + * both approaches. * * @author Juergen Hoeller * @since 2.5 diff --git a/spring-framework-reference/src/beans.xml b/spring-framework-reference/src/beans.xml index da2e2b19be8..e9befff368d 100644 --- a/spring-framework-reference/src/beans.xml +++ b/spring-framework-reference/src/beans.xml @@ -4438,7 +4438,14 @@ dataSource.url=jdbc:mysql:mydb @Qualifier, @Named, and @Provider if the JSR330 jar is present on the classpath. Use of these annotations also requires that certain BeanPostProcessors be registered - within the Spring container. As always, you can register them as + within the Spring container. + + Annotation injection is performed before XML injection, thus + the latter configuration will override the former for properties wired + through both approaches. + + + As always, you can register them as individual bean definitions, but they can also be implicitly registered by including the following tag in an XML-based Spring configuration (notice the inclusion of the context namespace):