Java SPI

Java SPI is a standard java way to have binding between contracts and implementations. SPI used for several use cases such as Currency, Locale, TimeZone, DateFormat, Number, JDBC Driver, JPA, Json, JasonB, and many more. I believe the most classical example is for JDBC/JPA use cases where you have one common spec(contract) and multiple implementations for each database driver such as MySQL, Postgres, etc... SPI is interesting, shower I would not use SPI for common bread a butter SOA / Microservices use cases. Because often you just have one contract and one implementation, for that case using the new keyword or even basic DI/IoC I would say is much more desirable, easier, and much more simple and straightforward. However, if your use case has multiple implementations(beyond versioning) thats definitely something you should consider.

The Video

The Code

https://github.com/diegopacheco/java-pocs/tree/master/pocs/spi-poc-fun

Cheers,

Diego Pacheco

Popular posts from this blog

C Unit Testing with Check

Having fun with Zig Language

HMAC in Java