Skip to content

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

Closed

Description

@spring-projects-issues

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

Activity

  1. spring-projects-issues commented on Nov 20, 2014

    @spring-projects-issues
    CollaboratorAuthor

    cemo koc commented

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

  2. spring-projects-issues commented on Nov 20, 2014

    @spring-projects-issues
    CollaboratorAuthor

    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

  3. spring-projects-issues commented on Nov 20, 2014

    @spring-projects-issues
    CollaboratorAuthor

    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.

  4. spring-projects-issues commented on Nov 20, 2014

    @spring-projects-issues
    CollaboratorAuthor

    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

  5. spring-projects-issues commented on Jan 13, 2015

    @spring-projects-issues
    CollaboratorAuthor

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

  6. spring-projects-issues commented on Feb 10, 2015

    @spring-projects-issues
    CollaboratorAuthor

    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.

  7. added
    type: enhancement
    in: core
    on Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

in: coretype: enhancement

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions