BAEL-1782 (#5067)
* Bean Object, server side and client side example for event streaming example * BAEL-1628 Access a File from the Classpath in a Spring Application * inputstream retrieval added * Removed files related to evaluation article * + Aligning code to the article. Removed Utility methods and classes * Precommit fix * PMD fixes * Code Review changes Refactored : whenResourceUtils_thenReadSuccessful * BAEL-1934 * +indentation correction in pom.xml * synced with master * Precommit : rebase * BAEL-1782
This commit is contained in:
parent
1256735a42
commit
991335da42
|
@ -0,0 +1,24 @@
|
|||
package com.baeldung.event.listener;
|
||||
|
||||
import org.springframework.context.event.ContextStartedEvent;
|
||||
import org.springframework.context.event.ContextStoppedEvent;
|
||||
import org.springframework.context.event.EventListener;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class ContextEventListener {
|
||||
|
||||
@Order(2)
|
||||
@EventListener
|
||||
public void handleContextRefreshEvent(ContextStartedEvent ctxStartEvt) {
|
||||
System.out.println("Context Start Event received.");
|
||||
}
|
||||
|
||||
@Order(1)
|
||||
@EventListener(classes = { ContextStartedEvent.class, ContextStoppedEvent.class })
|
||||
public void handleMultipleEvents() {
|
||||
System.out.println("Multi-event listener invoked");
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package com.baeldung.event.listener;
|
||||
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
@ComponentScan(basePackages = "com.baeldung.event.listener")
|
||||
public class EventConfig {
|
||||
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
package com.baeldung.event.listener;
|
||||
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
|
||||
public class SpringRunner {
|
||||
|
||||
public static void main(String[] args) {
|
||||
ConfigurableApplicationContext ctx = new AnnotationConfigApplicationContext(EventConfig.class);
|
||||
ctx.start();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue