added warnings regarding accidental usage of @Configurable on a managed bean (SPR-7216)

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@3414 50f2f4bb-b051-0410-bef5-90022cba6387
This commit is contained in:
Juergen Hoeller 2010-06-11 13:48:52 +00:00
parent 53ac18362a
commit 7a9f9febf8
2 changed files with 21 additions and 0 deletions

View File

@ -2959,6 +2959,16 @@ public class Account {
&lt;/bean&gt;</programlisting> &lt;/bean&gt;</programlisting>
<note>
<para>Do not activate <interfacename>@Configurable</interfacename>
processing through the bean configurer aspect unless you really
mean to rely on its semantics at runtime. In particular, make sure
that you do not use <interfacename>@Configurable</interfacename>
on bean classes which are registered as regular Spring beans with
the container: You would get double initialization otherwise, once
through the container and once through the aspect.</para>
</note>
<section id="aop-configurable-testing"> <section id="aop-configurable-testing">
<title>Unit testing <interfacename>@Configurable</interfacename> <title>Unit testing <interfacename>@Configurable</interfacename>
objects</title> objects</title>

View File

@ -553,6 +553,17 @@ public void doSomething() {
and must not expect any arguments. If the method needs to interact with and must not expect any arguments. If the method needs to interact with
other objects from the Application Context, then those would typically other objects from the Application Context, then those would typically
have been provided through dependency injection.</para> have been provided through dependency injection.</para>
<note>
<para>Make sure that you are not initializing multiple instances
of the same @Scheduled annotation class at runtime, unless you do
want to schedule callbacks to each such instance. Related to this,
make sure that you do not use @Configurable on bean classes which
are annotated with @Scheduled and registered as regular Spring beans
with the container: You would get double initialization otherwise,
once through the container and once through the @Configurable aspect,
with the consequence of each @Scheduled method being invoked twice.</para>
</note>
</section> </section>
<section id="scheduling-annotation-support-async"> <section id="scheduling-annotation-support-async">