Categories
Spring Spring Core

Bean Definition Inheritance

Inheritance in Java : To Inherit all the Properties and Methods of a Parent Class to Sub-Class. The same definition applies to the Spring Bean Definition Inheritance concept. Child Bean Definition can inherit the Constructor-args, property values, static factory method name, init-method name and so on from the Parent Bean Definition. From the above snippet […]

Categories
Spring Spring Core

Control Bean Creation Order in Spring

Generally we provide dependencies of a Bean using the <ref/> attribute in Spring Configuration Meta-Data as like below. The “employeeController” bean is directly depending on the “employeeManager” bean. But, all the dependencies of a Bean will not direct like this. Some dependencies will be indirectly referred into the Bean Object. For Example : EmployeeController class […]

Categories
Spring Spring Core

Instance Factory Method in Spring

The IoC container will invoke a non-static method of an Existing Bean to Instantiate an Object.  In our previous example we saw how Instantiation of Bean using Constructor args and Static-Factory Method with an Example. Now we will look at how Instantiation of Instance Factory Method works in Spring with an Example. Example of Instance […]

Categories
Spring Spring Core

Static Factory Method in Spring

In our previous article we saw how to instantiate a Bean with Constructor in Spring Framework. Now we will look at how we can instantiate a Static Factory Method.  Instantiate a Static Factory Method in Java  In a plain Java application we can instantiate the above Static Factory class as like below from another class […]

Categories
Spring

Naming and Aliasing of Beans

Naming of Beans Objects that are created and managed by a Spring IoC container are called as Beans. The container has to identify each and every bean that we are going to configure and use. To identify those beans we can provide ID and Name in Bean configuration Xml, each bean can have more than […]