Why do we need it? Used for common set of definitions across multiple beans Inherit bean definition across other beans Can be a bean itself Can be an abstract bean, just to be overridden Example config.xml childA and childB will both inherit the property definition commonPropertyName with a value of commonValue, but will each have... Continue Reading →
Spring Bean Scopes
singleton (default) only one instance per Spring Container prototype any number of instances request scoped to an HTTP request (web-aware Spring ApplicationContext) session scoped to an HTTP session (web-aware Spring ApplicationContext) global-session scoped to a global HTTP session (web-aware Spring ApplicationContext) <bean id="helloWorld" class="Hello" scope="singleton"> </bean> <bean id="helloWorld" scope="prototype"> </bean>
Spring Bean Attributes
<bean id="my bean" class="MyClass"/> class name scope constructor-arg properties auto wiring mode lazy-initialization mode initialisation method destruction method