clean-up of the @Bean content

This commit is contained in:
Thomas Risberg 2009-05-01 20:14:23 +00:00
parent 05f1d08028
commit 0383f705ae
1 changed files with 7 additions and 10 deletions

View File

@ -6048,10 +6048,9 @@ public @interface MovieQualifier {
project</ulink> have been added to the core Spring Framework. This project</ulink> have been added to the core Spring Framework. This
allows you to define beans using Java rather than using the traditional allows you to define beans using Java rather than using the traditional
XML files. Take a look at the XML files. Take a look at the
<interfacename>@Configuration</interfacename>, <interfacename>@Configuration</interfacename>, <interfacename>@Bean,
<interfacename>@Bean</interfacename>, @Import</interfacename> and <interfacename>@DependsOn</interfacename>
<interfacename>@Value</interfacename> annotations for how to use these annotations for how to use these new features.</para>
new features.</para>
</note> </note>
<section id="beans-stereotype-annotations"> <section id="beans-stereotype-annotations">
@ -6526,15 +6525,13 @@ public Service userService() {
<section id="beans-javaconfig-method-injection"> <section id="beans-javaconfig-method-injection">
<title>Lookup method injection</title> <title>Lookup method injection</title>
<para>As noted in the core documentation, <link <para>As noted earlier, <link
linkend="beans-factory-method-injection">lookup method linkend="beans-factory-method-injection">lookup method
injection</link> is an advanced feature that should be comparatively injection</link> is an advanced feature that should be comparatively
rarely used. It is useful in cases where a singleton-scoped bean has rarely used. It is useful in cases where a singleton-scoped bean has
a dependency on a prototype-scoped bean. Using Java for this type of a dependency on a prototype-scoped bean. Using Java for this type of
configuration provides a natural means for implementing this configuration provides a natural means for implementing this
pattern. <emphasis>Note that the example below is adapted from the pattern. <programlisting language="java"><![CDATA[public abstract class CommandManager {
example classes and configuration in the core documentation linked
above.</emphasis> <programlisting language="java"><![CDATA[public abstract class CommandManager {
public Object process(Object commandState) { public Object process(Object commandState) {
// grab a new instance of the appropriate Command interface // grab a new instance of the appropriate Command interface
Command command = createCommand(); Command command = createCommand();
@ -6548,8 +6545,8 @@ public Service userService() {
protected abstract Command createCommand(); protected abstract Command createCommand();
} ]]></programlisting></para> } ]]></programlisting></para>
<para>JavaConfig can easily create a subclass of <para>Using Java-configurtion support we can easily create a
<code>CommandManager</code> where the abstract subclass of <code>CommandManager</code> where the abstract
<code>createCommand()</code> is overridden in such a way that it <code>createCommand()</code> is overridden in such a way that it
'looks up' a brand new (prototype) command object: <programlisting 'looks up' a brand new (prototype) command object: <programlisting
language="java"><![CDATA[@Bean language="java"><![CDATA[@Bean