ApplicationListener « Context « Spring Q&A

1. Spring ApplicationListener is not receiving events

I have the following ApplicationListener:

package org.mycompany.listeners;

import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextStartedEvent;

public class MyApplicationListener implements ApplicationListener<ContextStartedEvent> {

  public MyApplicationListener() {
    System.out.println("Application context listener is created!");


2. sharing spring context and ApplicationListener

I'm sharing spring context using locatorFactorySelector and parentContextKey Is it possible for me to publish events in parent using applicationContext.publishEvent() regularly and listen for it in the child by implementing ApplicationListener? ...