I am in the process of submitting an app for Data Center approval and it is required to remove deprecated APIs usage.
I am making use of the “old” manager classes, such as PageManager, SpaceManager etc, and as those are deprecated, I found that I have to use the “new” service classes, such as PageService, SpaceService and alike.
Everything worked out until I started using the SpaceService in one of my Atlassian scheduler implementation, that is in class that implements the com.atlassian.scheduler.JobRunner interface, if I would do something like:
final Space space = this.spaceService.find ().withKeys ("ds").fetchOrNull ();
space is always null. However I do have a “ds” space, and from REST apis or other contexts it actually works just fine.
I am initializing the SpaceService wired in the constructor, as I was doing for the SpaceManager.
Does anyone have an idea why is this the case? And perhaps show a portion of code where such services are used in a scheduler contexts?
Caused by: java.lang.ClassNotFoundException: org.springframework.cglib.proxy.Factory not found by com.atlassian.plugin.osgi.bridge [1]
at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1639)
at org.apache.felix.framework.BundleWiringImpl.access$200(BundleWiringImpl.java:80)
at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:2053)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
If anyone is successfully using Spring Java configuration and the SpaceService I’d like to know how they got that service injected into their classes.
The mechanism I’m using for all the other services (like the old SpaceManager, etc.) works fine.
UPDATE:
I am able to inject SpaceService using Spring Java configuration. In my configuration class:
@Bean
public SpaceService spaceService() {
return importOsgiService(SpaceService.class);
}