Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ApplicationListener-like annotation for consuming application events [SPR-11622] #16245

Closed
spring-issuemaster opened this issue Mar 28, 2014 · 6 comments

Comments

Projects
None yet
2 participants
@spring-issuemaster
Copy link
Collaborator

commented Mar 28, 2014

Martin Krüger opened SPR-11622 and commented

It would be nice to have annotations instead of having to implement ApplicationListener<E extends ApplicationEvent>, for example:

public class MyListener {

    @Listen
    public void onDelete(DeleteEvent event) {}

    @Listen
    public void onAdd(AddEvent event) {}

}

The semantics are the same as for ApplicationListener, but multiple event types can be supported in a single class.


Issue Links:

  • #16696 Add support for transaction bound application events
  • #19689 Annotation-based event listener does not receive event published in @PostConstruct
  • #17263 Add support for ordered application event listener
  • #19208 Optimize ordered event listener performance
  • #17018 Support @Order on ApplicationListeners
  • #17223 Provide reusable parts of Cache implementation for others

Referenced from: commits f0fca89

1 votes, 6 watchers

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented Nov 20, 2014

cemo koc commented

I will be very happy If this will be backported to 4.1.x branch as well.

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented Nov 20, 2014

Juergen Hoeller commented

This is unlikely since the 4.2 branch will immediately supersede the 4.1 branch, just like 4.1 did for 4.0. And the annotated listener feature won't be trivial since we intend to do a rather comprehensive revision in that space, so it does not suggest itself as a backport candidate.

Fortunately, 4.2 won't raise the system requirements: It'll be a straightforward drop-in for 4.1, just with a bunch of new and revised features.

Juergen

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented Nov 20, 2014

cemo koc commented

The only downside of 4.2 for me is that we will have to wait at least mid of the next year. Thanks for the information.

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented Nov 20, 2014

Juergen Hoeller commented

Note that we have a rather aggressive release plan these days. 4.2 is going out by mid next year at the latest, with an RC scheduled for May. This is just about as much time as we need for proper design cycles here. Feel free to track 4.2 snapshots early as they become available in January...

Juergen

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented Jan 13, 2015

Stéphane Nicoll commented

There is a first cut available in 1bb2a20 (see also the event branch of my fork).

My current version needs to be largely reviewed and the project that Jean-Baptiste Nizet has provided in #16696 has interesting ideas for the post processing phase ( SmartInitializationSingleton is not invoked on lazy beans though).

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented Feb 10, 2015

Stéphane Nicoll commented

a method of a managed bean can now be annotated with @EventListener and we create an ApplicationListener matching the method argument. Besides, arbitrary objects can now be published as events.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.