Monday, April 21, 2014

[Spring] Spring IoC Contrainer & Spring Configurations

Spring IoC Container

  • The Spring IoC container is at the core of the Spring Framework
  • Uses IoC to manage components that make up an application
  • Components are expressed as regular Java Beans
  • Container manages the relationships between beans and is responsible for configuring them
  • Manages the lifecycle of the beans

Spring Configurations
  • Ref-Bean
    •  <ref bean> element
      • used to set properties that reference other beans
      • defined as sub-element of <property> element
      • e.g.
      •  
  • Inner Bean
    • A <bean/> element inside the <property/> or <constructor-arg/> elements
    • Inner beans do not have an id attribute.
    • Inner beans in constructor injection
  • Compound Properties
    •   "country" bean must have a "person" nested bean, which in turn has an "age" property.
    • Equivalent to countryBean.getPerson().setAge(23)

No comments:

Post a Comment