<bean id="kenny"
class="com.springinaction.springidol.Instrumentalist"
init-method="tuneInstrument"
destroy-method="cleanInstrument">
<property name="song" value="Jingle Bells" />
<property name="instrument" ref="saxophone" />
</bean>
Consider the following abstract parent <bean> declaration:
<bean id="basePerformer" abstract="true">
<property name="song" value="Somewhere Over the Rainbow" />
</bean>
This basePerformer bean declares the common song property that our two per-
formers will share. But notice that it doesn’t have a class attribute set. That’s
okay, because each child bean will determine its own type with its own class
attribute. The new declarations of taylor and stevie are as follows:
<bean id="taylor"
class="com.springinaction.springidol.Vocalist"
parent="basePerformer" />
<bean id="stevie"
class="com.springinaction.springidol.Instrumentalist"
parent="basePerformer">
<property name="instrument" ref="guitar" />
</bean>
dispense
thermometer
before/after 后面动词是doing的形式
rummage
转载于:https://blog.51cto.com/vcycyv/291429