Singleton to OSGi Declarative Services: Seeking Guidance

26 Views Asked by At

I have experience working with OSGi and Maven. Previously, I used the singleton pattern to register instances of classes. However, I'm now interested in exploring OSGi declarative services for registering class instances. I'm seeking guidance on how to proceed. Should I register them during bundle initialization, or is there another approach I should consider? Your suggestions would be greatly appreciated. Thanks in advance for your assistance!

1

There are 1 best solutions below

1
Marcos Zolnowski On

If you are using the maven-bundle-plugin, you don't need extra steps, it does the registration for you.

An article about bundling declarative services: https://dzone.com/articles/karaf-features-and-osgi-services-a-bundle