Dear friends,
Why is my bean not creating new instantace evey time in this case.
Code:
This is where I want new bean in every place.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>
Code:
Please help me doing this.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; }
I cannot remove service factory to instantiate it as it is part of legacy application. But want o use spring also.![]()



Reply With Quote
