Skip to content

Instantly share code, notes, and snippets.

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 vladdedita/34c1fda2ff971639f77a9bb10f2f7f6b to your computer and use it in GitHub Desktop.
Save vladdedita/34c1fda2ff971639f77a9bb10f2f7f6b to your computer and use it in GitHub Desktop.
public interface NotificationService {
void sendNotification(String message, String recipient);
String getServiceName();
}
@Component
public class EmailNotificationService implements NotificationService {
public void sendNotification(String message, String recipient) { /* Email sending logic */ }
public String getServiceName() { return "Email"; }
}
@Component
public class SMSNotificationService implements NotificationService {
public void sendNotification(String message, String recipient) { /* SMS sending logic */ }
public String getServiceName() { return "SMS"; }
}
@Component
public class PushNotificationService implements NotificationService {
public void sendNotification(String message, String recipient) { /* Push notification logic */ }
public String getServiceName() { return "Push"; }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment