Ed McCormic Source on GitHub
All specs

Spring Boot and Java deep dives

Factory Pattern API

Notification and payment APIs that pick an implementation through Spring-managed factories.

View code on GitHub

Goals

  • NotificationSenderFactory choosing between Email, SMS, Push, and Slack senders
  • PaymentProcessorFactory choosing between Credit Card, PayPal, and UPI processors
  • Unsupported types return a clean error through GlobalExceptionHandler

Design notes

Each implementation is a Spring bean. The factory collects them into a map keyed by their enum, so adding a channel means adding one class (Slack was added this way after the first pass).

Changelog

  • 2026-09-28: Built, then added the Slack channel