-
Jan 27th, 2011, 02:14 AM
#1
How to use addListener method?
I have to use a class that uses an addListener() method instead of setListeners()
How to inject the listener?
-
Jan 27th, 2011, 08:14 AM
#2
Some possible choices:
1) Create a setListener method which just calls addListener (this is a quick but dirty fix);
2) Dependency inject through constructor arg;
3) Change your addListener to setListener and refactor;
4) Use @Autowired directly on the private "listener" attribute (this supposes you have one and only one class of the listener type registered as a Spring bean in the context, either by xml definition or component scanning).
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules