文章预览
作者 | 飞天小牛肉 来源 | 飞天小牛肉 什么是 SPI SPI 全称为 (Service Provider Interface) ,是 JDK 内置的一种服务提供发现机制,为使用者提供了服务扩展点,使用者无需修改源码就可以自定义服务实现,简单理解就是为服务的具体实现提供了一个可插拔机制。 比如你的项目中 SPI 的Java doc 如下,感兴趣的小伙伴可以阅读下: A service is a well-known set of interfaces and (usually abstract) classes. A service provider is a specific implementation of a service. The classes in a provider typically implement the interfaces and subclass the classes defined in the service itself. Service providers can be installed in an implementation of the Java platform in the form of extensions, that is, jar files placed into any of the usual extension directories. Providers can also be made available by adding them to the application's class path or by some other platform-specific means Java SPI 实战 设想
………………………………