Results 1 to 1 of 1
- 09-26-2007, 08:40 PM #1
Look-Up Method Injection and it’s usage in Spring Framework
This is the feature of the container to override abstract or concrete methods on managed beans in the container, to return the result of look up another named bean in the container. Usually lookup is done for a prototyped Bean.
Code of client class containing the method to be injected the method definition must be an abstract (or concrete).
In case programmer does not make method abstract Spring will override existing implementation.Java Code:protected abstract SimpleHelper createSimpleHelper();
Write Following Code in Bean Configuration File
It is important that SimpleHelper Should be prototyped otherwise always same instance will be returnedJava Code:<bean id="simpleHelper" class="..." singleton="false"/> <bean id="CallerBean" class="..."> <lookup-method name="createSimpleHelper" bean="SimpleHelper"/> <property> ... </property> </bean>
Similar Threads
-
Look-Up Method Injection and it’s usage in Spring Framework
By Java Tip in forum Java TipReplies: 0Last Post: 03-30-2008, 10:09 AM -
What is need of method injection
By Java Tip in forum Java TipReplies: 0Last Post: 03-30-2008, 10:08 AM -
How to decide whether to use Setter injection or constructor injection in your code
By Java Tip in forum Java TipReplies: 0Last Post: 03-29-2008, 12:38 PM -
What is need of method injection
By JavaBean in forum Java TipReplies: 0Last Post: 09-26-2007, 08:39 PM -
How to decide whether to use Setter injection or constructor injection in your code
By JavaBean in forum Java TipReplies: 0Last Post: 09-26-2007, 08:29 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks