Package com.atlassian.confluence.util
Class OsgiUtils
- java.lang.Object
-
- com.atlassian.confluence.util.OsgiUtils
-
public class OsgiUtils extends Object
This util helps plugins to do shady things directly with OSGi.- Since:
- 7.0.1
-
-
Constructor Summary
Constructors Constructor Description OsgiUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Optional<Object>
findApplicationContextInOsgiBundle(com.atlassian.plugin.Plugin plugin)
HACK Grab the bean with a name matching the jobKey from the target plugin's.
-
-
-
Method Detail
-
findApplicationContextInOsgiBundle
public static Optional<Object> findApplicationContextInOsgiBundle(com.atlassian.plugin.Plugin plugin)
HACK Grab the bean with a name matching the jobKey from the target plugin's. Ideally, we'd be loading an OSGi ServiceReference by name, but that won't work for us here, due to spring-scanner not supporting adding custom properties, and OSGi not having named service instances by default. Sigh DO NOT DO WHAT I HAVE DONE :(The reason why this method returns
Optional<Object>
instead ofOptional<ApplicationContext>
is to avoid class casting errors between different classloaders, e.g.java.lang.ClassCastException: org.springframework.osgi.atlassian.NonValidatingOsgiBundleXmlApplicationContext cannot be cast to org.springframework.context.ApplicationContext
-
-