Understanding Java SPI with Practical Code Examples

Java SPI Overview Java SPI (Service Provider Interface) is a built-in mechnaism for discovering and loading service implementations dynamically. Instead of hardcoding specific implementation classes, SPI allows you to define a service interface and have multiple providers supply their own implementations. The ServiceLoader class, part of the JD ...

Posted on Thu, 18 Jun 2026 17:09:31 +0000 by indigobanana

Understanding Java SPI Through JDBC, Spring, and Dubbo

Java Service Provider Interface (SPI) SPI (Service Provider Interface) is a service discovery mechanism that provides extension points for interface implementations. Introduced in JDK 6 (see the Since field of java.util.ServiceLoader), SPI enables dynamic loading of concrete service providers at runtime, promoting decoupling and offernig Invers ...

Posted on Sat, 13 Jun 2026 17:55:23 +0000 by wattsup88

Understanding Java's ServiceLoader for Dynamic Provider Discovery

Understanding Java's ServiceLoader for Dynamic Provider Discovery ServiceLoader is a Java utility designed for dynamic loading of service providers. A service in this context refers to a set of interfaces and classes (typically abstract classes), while a service provider represents an implementation of that service. ServiceLoader can automatica ...

Posted on Tue, 26 May 2026 16:23:56 +0000 by wystan

Resolving Not Supported Exception for XML External DTD Access via SPI Mechanism

Problem Context During Fortify security scanning, XML External Entity Injection (XXE) vulnerabilities were detected in XML processing code. XXE attacks exploit dynamic document construction features in XML parsers. The remediation involved adding security configurations to prevent external entity inclusion in incoming XML documents. During the ...

Posted on Mon, 25 May 2026 18:57:15 +0000 by Enlightened

Understanding SPI and Its Role in JDBC Driver Loading

What Is SPI? SPI (Service Provider Interface) is a mechanism in Java that enables dynamic discovery of service implementations at runtime. It scans the META-INF/services/ directory on the classpath for files named after fully qualified interface names. Each file lists concrete implementation classes, allowing frameworks to load them without har ...

Posted on Fri, 22 May 2026 19:51:18 +0000 by vponz