How to use Spring Factory Method to create Spring Bean

Spring Framework provides Spring Factory Method mechanics to create Beans from static(non-static) method of a Factory Class in XML config files. In the tutorial, JavaSampleApproach will introduce Spring Factory Method with sample codes.

Related Posts:
How to inject Collection in Spring
Inject Properties from Properties File using Spring Environment

[Continue reading…] “How to use Spring Factory Method to create Spring Bean”

Spring Bean Post Processors

The BeanPostProcessor interface helps us provide our own methods before the initialization of beans and likewise after the initialization of the bean.

BeanPostProcessor are common for all beans in the container where it is defined, so it is different from @PostConstruct, InitializingBean and custom init method which are defined on the bean itself.

Related Article: Spring Bean Life Cycle

[Continue reading…] “Spring Bean Post Processors”

Spring Bean Life Cycle – Callback Interface, Custom Method, Annotation, Aware Interface

Spring Bean Life Cycle is very important because in many applications, we want to create some operations before initializing a Bean or make some operations before bean’s destruction.

This tutorial introduce four ways to control life cycle events of a Bean.

[Continue reading…] “Spring Bean Life Cycle – Callback Interface, Custom Method, Annotation, Aware Interface”

Spring Bean Scopes – Singleton and Prototype

Spring Bean Scopes helps you control the scope of the objects which are created from bean definition. This approach is wonderful because you can choose the scope by configuring bean instead of working at Java class level.

The Spring Framework supports 7 scopes, but this tutorial introduces you 2 of them: singleton scope and prototype scope. The others will be discussed in next article.

[Continue reading…] “Spring Bean Scopes – Singleton and Prototype”

Spring Bean Definition Inheritance | Spring Boot

Bean Definition Inheritance is a good solution for defining new bean which inherited certain bean conveniently.

We will learn how to use XML configuration to create Inheritance from Bean with parent or abstract template.

[Continue reading…] “Spring Bean Definition Inheritance | Spring Boot”