I am new Springs. In Bean tag I found factory-method and factory-bean Attributes. What is the difference between factory-method and factory-bean?
I am using factory-meth
in spring we use factory-method because in java predefine class and some use define class are there the are not provide direct to create the object of other class there are some abstract class we can not create object but in side the class there are method are there like Calendar
class we can not create the object of Calendar
class
Calendar cal = new Calendar();
it is wrong on that thime its give error but it is provide the method getInstance()
we can call the method and we can instance the class
Example:
Calendar cal=Calendar.getInstance();
it is correct on that time we use factory method in the spring example: