OSGi is a Java module system and service platform that lets applications be built from small, reusable components called bundles. It manages dynamic installation, versioning, and lifecycle of these modules, allowing them to be added, updated, or removed at runtime without restarting the application.
OSGi
OSGi is a Java module system and service platform that lets a large application be assembled from small, independently versioned components called bundles. It defines a lifecycle and a service registry so those bundles can be installed, started, updated, and removed at runtime without restarting the whole application. Originally the “Open Services Gateway initiative,” it became the backbone of modular Java in everything from Eclipse to enterprise middleware.
- Bundles - The unit of modularity is a JAR with extra metadata declaring exactly what it exports and requires.
- Dynamic lifecycle - Modules can be added, updated, or stopped while the application keeps running, enabling hot deployment.
- Service registry - Bundles publish and consume services through a registry, decoupling providers from consumers at runtime.
- Strict versioning - Explicit package-level version constraints let multiple versions of a dependency coexist without conflict.
In practice OSGi shapes how modular Java servers and gateways are built, and it long sat behind the platforms that expose and manage APIs rather than being an API contract itself. Its service-registry and dynamic-lifecycle ideas — wiring loosely-coupled components that discover each other at runtime — prefigure much of how service-oriented and microservice architectures were later assembled. For teams running older Java estates, OSGi remains the framework that governs how their internal services are packaged, versioned, and deployed.