Share this article on


OSGi Component


If we want any object to be managed by the OSGi container, we should declare it as a component. Using annotations, we could make a POJO a OSGi component by annotating it with @Component. With this, we will get the ability to start, stop and configure the component using the felix web console. All objects managed by OSGi container are components. we qualify components as services. This means that all services are components but not vice-versa.
OSGi Service

OSGi components can be made as OSGi service by marking it with @Service annotation. When we mark a component as service, we can this service from other osgi components. Components can call (using container injection – @Reference) other services but not components. In other words, a component cannot be injected into another component / service. Only services can be injected into another component.


OSGi Component Vs Service
  • All objects managed by OSGi container are components. we can qualify components as services. This means that all services are components but not vice-versa.
  • Components can call (using container injection – @Reference) other services but not components. In other words, a component cannot be injected into another component / service. Only services can be injected into another component.

Share this article on