Document @Autowired and @Value limitations

@Autowired, @Value and other annotations cannot be applied within
Spring Bean(Factory)PostProcessor types, because they themselves
are processed using BeanPostProcessors.  Javadoc and reference docs
have been updated to reflect.

Issue: SPR-4935, SPR-8213

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4300 50f2f4bb-b051-0410-bef5-90022cba6387
This commit is contained in:
Chris Beams
2011-05-13 03:41:29 +00:00
parent 4e1de28861
commit 31bc941b28
4 changed files with 45 additions and 9 deletions
@@ -277,6 +277,7 @@
interfaces that are well-known resolvable dependencies:
<interfacename>BeanFactory</interfacename>,
<interfacename>ApplicationContext</interfacename>,
<interfacename>Environment</interfacename>,
<interfacename>ResourceLoader</interfacename>,
<interfacename>ApplicationEventPublisher</interfacename>, and
<interfacename>MessageSource</interfacename>. These interfaces and their
@@ -295,6 +296,21 @@
<lineannotation>// ...</lineannotation>
}</programlisting>
<note>
<para>
<interfacename>@Autowired</interfacename>,
<interfacename>@Inject</interfacename>,
<interfacename>@Resource</interfacename>, and
<interfacename>@Value</interfacename> annotations are handled by a
Spring <interfacename>BeanPostProcessor</interfacename> implementations
which in turn means that you <emphasis>cannot</emphasis>
apply these annotations within your own
<classname>BeanPostProcessor</classname> or
<classname>BeanFactoryPostProcessor</classname> types (if any). These
types must be 'wired up' explicitly via XML or using a Spring
<interfacename>@Bean</interfacename> method.</para>
</note>
</section>
<section id="beans-autowired-annotation-qualifiers">