You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently a component must implement the services it exposes through the service factory.
There are sometimes cases where one want to expose a service with DS, but creation of such service won't be possible by DS what for example includes:
The service is not an interface but a final class that needs constructor arguments that are dependencies or need to be constructed from injected services, java records are a good example as well as many (non OSGi) libraries
The constructor is invisible and instances can only be created by a static factory
Current state
This currently forces one to use some indirection, e.g have a component that does not expose a service, injects a bundle context and then register/unregistered the service. This contradicts the idea of letting the SCR manage the service lifecycle, for example this means such a component must always be active and possibly registering services that are never used.
Proposed solution
If a component exposes exactly one service S instead of requiring the component to implement this service it is allowed to alternatively implement the ServiceFactory / PrototypeServiceFactory interface with the generic parameter of <S>.
The text was updated successfully, but these errors were encountered:
Currently a component must implement the services it exposes through the service factory.
There are sometimes cases where one want to expose a service with DS, but creation of such service won't be possible by DS what for example includes:
Current state
This currently forces one to use some indirection, e.g have a component that does not expose a service, injects a bundle context and then register/unregistered the service. This contradicts the idea of letting the SCR manage the service lifecycle, for example this means such a component must always be active and possibly registering services that are never used.
Proposed solution
If a component exposes exactly one service
S
instead of requiring the component to implement this service it is allowed to alternatively implement theServiceFactory
/PrototypeServiceFactory
interface with the generic parameter of<S>
.The text was updated successfully, but these errors were encountered: