Skip to content

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

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

Closed
spring-projects-issues opened this issue Mar 28, 2014 · 6 comments
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues 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:

Referenced from: commits f0fca89

1 votes, 6 watchers

@spring-projects-issues
Copy link
Collaborator Author

cemo koc commented

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

@spring-projects-issues
Copy link
Collaborator Author

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-projects-issues
Copy link
Collaborator Author

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-projects-issues
Copy link
Collaborator Author

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-projects-issues
Copy link
Collaborator Author

spring-projects-issues 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-projects-issues
Copy link
Collaborator Author

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
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants