Ray's playground

 

Advanced bean wiring(Chapter 3 of Spring In Action)

  To accommodate sub-beaning, the <bean> element provides two special attributes:
  ■ parent—Indicates the id of a <bean> that will be the parent of the <bean> with the parent attribute. The parent attribute is to <bean> what extends is to a Java class.
  ■ abstract—If set to true, indicates that the <bean> declaration is abstract. That is, it should never be instantiated by Spring.

 

  Spring supports two forms of method injection:

  ■ Method replacement—Enables existing methods (abstract or concrete) to be replaced at runtime with new implementations.
  ■ Getter injection—Enables existing methods (abstract or concrete) to be replaced at runtime with a new implementation that returns a specific bean from the Spring context.

 

  By implementing certain interfaces, you can cause Spring to treat beans as special—as part of the Spring Framework itself. By taking advantage of these special beans, you can configure beans that

  ■ Become involved in the bean’s creation and the bean factory’s lifecycles by postprocessing bean configuration

  ■ Load configuration information from external property files

  ■ Load textual messages from property files, including internationalized messages

  ■ Listen for and respond to application events that are published by other beans and by the Spring container itself

  ■ Are aware of their identity within the Spring container 

posted on 2010-06-24 21:54  Ray Z  阅读(199)  评论(0编辑  收藏  举报

导航