Last active
November 24, 2021 08:09
-
-
Save thomasmartin-whoz/0751fc527be9355fb09a644bb29a1dcb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* A Micronaut adapter for Spring application listeners. | |
* Grails now uses micronaut so application events will be listened to here. | |
* To avoid rewriting event listening configuration, based on spring, this class dispatches events to the spring listeners. | |
*/ | |
@Singleton | |
class ApplicationEventListenerAdapter implements ApplicationEventListener<WhozEvent> { | |
@Inject | |
MicronautApplicationContext applicationContext | |
@Override | |
void onApplicationEvent(WhozEvent event) { | |
if (event instanceof ProfileEvent) { | |
applicationContext.getBean(ProfileEventListener).onApplicationEvent(event) | |
} | |
if (event instanceof SkillEvent) { | |
applicationContext.getBean(SkillEventListener).onApplicationEvent(event) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment