Created
July 29, 2017 09:43
-
-
Save jeevan-patil/4e72cc0ee9377d82177de512c3ffac9f to your computer and use it in GitHub Desktop.
Event Listener class.
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
import org.springframework.beans.factory.annotation.Autowired; | |
import org.springframework.context.ApplicationListener; | |
import org.springframework.stereotype.Component; | |
@Component | |
public class EntityCreatedEventListener implements ApplicationListener<EntityCreatedEvent> { | |
@Autowired | |
private EmailService emailService; | |
@Override | |
public void onApplicationEvent(EntityCreatedEvent event) { | |
if (event.getEntity() != null) { | |
if (event.getEntity() instanceof Project) { | |
emailService.sendProjectCreatedMail(project.getOwnerEmail()); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment