What is the difference between Service Provider Interface (SPI) and Application Programming Interface (API)?
More specifically, for Java libraries, what makes them a
API stands for Application Programming Interface, where API is a means for accessing a service / function provided by some kind of software or a platform.
SPI stands for Service Provider Interface, where SPI is way to inject, extend or alter the behavior for software or a platform.
API is normally target for clients to access a service and it has the following properties:
-->API is a programmatic way of accessing a service to achieve a certain behavior or output
-->From API evolution point of view, addition is no problem at all for clients
-->But API's once utilized by clients it can not (and should not) be altered / deleted unless there are an appropriate communications, since its a complete degradation of the client expectation
SPI on the other part are targeted for providers and has the following properties:
-->SPI is a way to extend / alter the behavior of a software or a platform (programmable vs. programmatic)
-->SPI evolution is different from API evolution, in SPI removal is not an issue
-->Addition of SPI interfaces will cause problems and may break existing implementations
For more explanation click here : Service Provider Interface