Results 1 to 1 of 1
- 09-26-2007, 08:25 PM #1
Instantiation using an instance factory method
There is provision where factory method of an existing bean from the container can be the factory bean, which contains a method called createInstance().
To use this technique the 'class' attributes must be left empty, and the 'factory-bean' attribute will specify the name of a bean in the current or lower bean factory which contains the factory method. The factory method is set via the 'factory-method' attribute.
Following code will give more clarity
<bean id="abcBean" class="..."> </bean> <!-- the bean to be created via the factory bean --> <bean id="sampleBean" factory-bean="abcBean" factory-method="createObject"/>
- By Java Tip in forum Java TipReplies: 0Last Post: 03-29-2008, 12:35 PM
- By desmond5 in forum New To JavaReplies: 1Last Post: 03-08-2008, 06:41 PM
- By Camden in forum New To JavaReplies: 1Last Post: 03-02-2008, 04:44 PM
- By kavithas in forum New To JavaReplies: 2Last Post: 12-05-2007, 04:56 PM
- By vglass in forum Java SoftwareReplies: 0Last Post: 07-20-2007, 01:44 PM