An Extensible application is one in which you can extend without modifying its original code base. Using SPI all you have to do is to add a jar (with META-INF/services/<interface> file in applicaitons class path or extended library location) and the services will be found and made available to the application.
Service: A set of programming interfaces and classes that
- Define a functionality (Service Interface).
- And a way to retrieve an implementation (Service Access API).
- And a way to regiser a provider (Registration API).
Service Provider Interface: A Set of public interfaces and abstract classes that providers implement to create an instance of their Service Implementation.
Service Provider: Implements SPI.
1. A word processor application that allows end users to write their own dictionary and spell checkers.
- DictionaryServiceDemo: Applicaiton Name
- DictionaryDemo.java: Client
- DictionaryService.java: Service Interface; Service Access Interface; Provier Registration through SPI standard
- Dictionary.java: SPI
- ExtendedDictionary.java: Service Provider 1
- GeneralDictionary: Service Provider 2
2. In JDBC Connection plays part of Service Inreface (or the feature that clients use); Driver.getConnection is Servce Access API; DriverManager.registerDriver is the provider registration API; Driver is the SPI that service providers implement.