Annotation Interface SPI


Identifies a contract intended for participation by an external service provider and specifies how provider code is expected to participate.

SPI classification may also be implied by placement in an .spi package. This annotation makes the supported provider roles explicit for a package, type, or member, including exceptions to package-derived classification.

SPI classification is distinct from application API classification. Public visibility of an SPI element does not, by itself, make that element supported for direct use by provider code.

The roles USE, IMPLEMENT, and SUPPLY are independent. No role implies another role. Compatibility must be evaluated against every applicable role.

Unless the contract is incubating, SPI support applies across the maintenance releases of one X.Y release family. Within that family, Hibernate aims to preserve both linkage of already-compiled providers and recompilation of their source. Compatibility across different X.Y families is not guaranteed. See the Hibernate compatibility policy.

Since:
8.0
Implementation Note:
Runtime retention allows build tooling to report and validate SPI classifications from compiled metadata.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
    Describes how external provider code participates in an SPI contract.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    The ways external provider code is intended to participate in the annotated contract.
  • Element Details

    • value

      SPI.Role[] value
      The ways external provider code is intended to participate in the annotated contract.
      Returns:
      the independent provider roles; defaults to SPI.Role.USE
      Default:
      {USE}