Announcement Announcement Module
Collapse
No announcement yet.
How to use addListener method? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to use addListener method?

    I have to use a class that uses an addListener() method instead of setListeners()

    How to inject the listener?

  • #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).

    Comment

    Working...
    X