A Java geek
  • Me
  • Books
  • Speaking
  • Mentions
  • Focus
  • Newsletters

spi

A collection of 1 posts
Making ServiceLoader usable: a provider factory
Java

Making ServiceLoader usable: a provider factory

I keep coming back to java.util.ServiceLoader. I have used it to put a JSON layer behind a contract, so the core code carries no direct dependency on any particular JSON library, and I can swap the implementation without touching callers. The same shape works for JWT handling, where the concrete library might be jose4j or another JOSE implementation, and you can easily find other decoupling use-cases.

Jul 12, 2026
A Java geek © 2008-2026
v. a4bdb6007c16bb0fdf86c3f59c5c525dbd187507/15305135126
Latest Posts