Skip to content

Instantly share code, notes, and snippets.

@jeevan-patil
Last active July 29, 2017 10:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeevan-patil/65d01c61fc5755b08b6f0937b4693df6 to your computer and use it in GitHub Desktop.
Save jeevan-patil/65d01c61fc5755b08b6f0937b4693df6 to your computer and use it in GitHub Desktop.
Project Service Implementation which publishes the event.
@Service
public class ProjectServiceImpl implements ProjectService {
@Autowired
private ApplicationEventPublisher applicationEventPublisher;
@Override
public void createProject(Project project) {
// save project entity in the database and publish an event to send mail to project owner
publishProjectCreatedEvent(project);
}
void publishProjectCreatedEvent(final Project project) {
EntityCreatedEvent entityCreatedEvent = new EntityCreatedEvent(this, project);
applicationEventPublisher.publishEvent(entityCreatedEvent);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment