Prototype Beans not creating as they should be.
Dear friends,
Why is my bean not creating new instantace evey time in this case.
Code:
Code:
<bean id="serviceFactory" class="helpers.ServiceFactoryImpl" autowire="byType" autowire-candidate="true">
<property name="_userService" ref="userService" ></property>
</bean>
<bean id="userService" class="cursive.company.service.UserService" scope="prototype" autowire="byType" autowire-candidate="true">
</bean>
This is where I want new bean in every place.
Code:
Code:
public String signin()
{
try
{
userService = serviceFactory.get_userService() ;
userService1 = serviceFactory.get_userService();
// UserService & UserService1 are same, I want them different objects everytime
}
catch (Exception e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
return ERROR;
}
Please help me doing this.
I cannot remove service factory to instantiate it as it is part of legacy application. But want o use spring also.:confused::confused::confused: