OSGi fits your requirements, but I would say, do you really mean your service implementation will change dynamically? And, if you get no service implementation, what does it mean? Same question but if you get several implementations... will you call all implementations... the best one? ...and when that or those service(s) would be stopped/removed???
Some thoughts: => If your JPA stuff really needs "a" service, then maybe you should only instantiate it when that service is found => If you want the best service implementation so you will have to handle that case yourself (not "basic" OSGi afaik) => I really appreciate Blueprint and use it as much as possible (i.e. when relevant), maybe you can take a look to this spec JP [@@ THALES GROUP INTERNAL @@] -----Message d'origine----- De : ellirael [mailto:ellir...@mail.ru] Envoyé : jeudi 18 juin 2015 17:41 À : user@karaf.apache.org Objet : Best way to access OSGi services from classes which object creation I cannot handle I'm looking for best solution to gain access to OSGi services in classes which object creation I cannot handle. For example I need to call some OSGi services in JPA event listener @PostPersist callback method. How to inject services to such objects? How to refresh services links when their implementation change? How to ensure that all resources are freed when I update or restart bundle with services? To save dynamism is a must for my tasks. -- View this message in context: http://karaf.922171.n3.nabble.com/Best-way-to-access-OSGi-services-from-classes-which-object-creation-I-cannot-handle-tp4040986.html Sent from the Karaf - User mailing list archive at Nabble.com.