Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save vladdedita/962670a01f1f26f64a788a1f48b20483 to your computer and use it in GitHub Desktop.
Save vladdedita/962670a01f1f26f64a788a1f48b20483 to your computer and use it in GitHub Desktop.
@Service
public class NotificationManager {
@Autowired
private List<NotificationService> notificationServices;
public void sendNotifications(String message, String recipient) {
for (NotificationService service : notificationServices) {
service.sendNotification(message, recipient);
}
}
public List<String> getAvailableNotificationServices() {
return notificationServices.stream()
.map(NotificationService::getServiceName)
.collect(Collectors.toList());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment