The difference between SPI and API

Source: Internet
Author: User
Reproduced from Stack Overflow, original address: Http://stackoverflow.com/questions/2954372/difference-between-spi-and-api

What is the difference between Service Provider Interface (SPI) and application Programming Interface (API)?

More specifically, for Java libraries, what makes them an API and/or SPI?

The API is the description of classes/interfaces/methods/... that's call and use to achieve a goal

The SPI is the description of classes/interfaces/methods/... that's extend and implement to achieve a goal

Put differently, the API tells you "a specific class/method does for you and the SPI tells you are must do to con Form.

Sometimes SPI and API overlap. For example in JDBC the Driver class was part of the spi:if you simply want to use JDBC, you don ' t need to use it directly , but everyone who implements a JDBC driver must implement that class.

The Connection interface on the other hand was both SPI and api:you use it routinely if you use a JDBC driver and it nee DS to is implemented by the developer of the JDBC driver.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.