1. Observer design pattern
Observer Pattern is one of the behavioral design pattern. Observer design pattern is useful when you are interested in the state of an object and want to get notified whenever there is any change. In observer pattern, the object that watch on the state of another object are called Observer and the object that is being watched is called Subject.
Realtime used: Badge creation
a. public class BadgeResultEvent extends ApplicationEvent {
b. @EventListener
public void handleBadgeEvent(BadgeResultEvent badgeResultEvent) {
c. applicationEventPublisher.publishEvent(new BadgeResultEvent(badgeTransaction));
Refernces:
http://www.journaldev.com/1739/observer-design-pattern-in-java
No comments:
Post a Comment