Scroll Exporter Java API Null pointer / Expected AutoWire Candidate

Hello everyone, looking for help with this API call.
I have this
ScrollApi class, for the Scroll Word Exporter API

public class ScrollApi {

  @Autowired @ComponentImport private WordExportService wordExportService;
  @Autowired @ComponentImport private WordTemplateService wordTemplateService;

And this is my PluginTest class

public class PluginTest extends ConfluenceActionSupport implements PageAware {
  @Autowired private ScrollApi scrollApi;

The problem is that when i use the ScrollApi class from the PluginTest it redirects me to “Page Not Found”, with the following error

ERROR [http-nio-1990-exec-4] [atlassian.confluence.servlet.ConfluenceServletDispatcher] serviceAction There is no Action mapped for namespace /plugins/plugintest and action name plugin-test

And this is the error when disabling/enabling the plugin

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'com.plugin.PluginTest': Unsatisfied dependency expressed through field 'scrollApi'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.plugin.scrollApi' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}

And if the Autowire annotation is removed from the PluginTest class, it throws a null pointer exception, i believe it has something to do with the dependency injection, however i’m not sure how to fix this

Any help would be appreciated, thanks in advance

Hello @JohnReese

I see that you are using the @Component and @ComponentImport annotations, those get processed with the atlassian spring scanner maven plugin (see Bitbucket)

The error you’re getting implies that you are probably missing the following maven plugin definition in your pom file , is it the case ?


A working example is available here welcome scroll exporter api action community example · viqueen/atlassian-devbox@b1e8dd0 · GitHub

I hope this helps

Hasnae R. (aka Hasnae of Confluence/Atlassian)

1 Like

Hello @viqueen-hasnae thank you very much for your help.
And you are right, i didn’t have that maven plugin.

I added it to the pom file, just like the one in the example but still have the same problem.

I checked your files and my files are more or less the same. I’ll check it more carefully and hopefully find what’s missing on my plugin.

Once again thank you very much for your help. Hope to update it soon with a resolution!

Hello @JohnReese ,
For spring scanner , did you follow the setup described in here too ? Bitbucket

The main things for the @Component and @ComponentImport annotations to work is to configure the maven plugin I mentioned earlier , and also update the META-INF/spring/plugin-context.xml file too that contains the scan-indexes tag (similar to this atlassian-devbox/plugin-context.xml at main · viqueen/atlassian-devbox · GitHub)