Hi all,
I was trying to do the first helloworld macro tutorial for Confluence from the Atlassian developer website (Create a Confluence 'Hello World' macro (atlassian.com)) and it seems like the atlassian spring scanner can't find the PageBuilderService class to import it. I'm new to Confluence plugin development so I don't know if this is a spring scanner problem or the class is deprecated.
If someone has another way of accessing the web resources that is also fine, the point here is not that I can't do the tutorial, but the fact I don't know why it doesn't work, so if you know the answer please give a detailed one.
Of course I added the appropriate plugin and dependencies to the pom.xml as shown in the spring scanner README (atlassian / atlassian-spring-scanner / README.md — Bitbucket) and modified the plugin-context.xml.
Thank you,
Illés Ákos
Here are the logs:
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'tutorial.macro.helloworld': Unsatisfied dependency expressed through constructor parameter 0; nested
exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.atlassian.webresource.api.assembler.PageBuilderService' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@com.atlassian.plugin.spring.scanner.annotation.imports.ComponentImport("")}
Here is my hellowrold.java:
import com.atlassian.plugin.spring.scanner.annotation.imports.ComponentImport;
import com.atlassian.webresource.api.assembler.PageBuilderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class helloworld implements Macro {
private final PageBuilderService pageBuilderService;
@Autowired
public helloworld(@ComponentImport PageBuilderService pageBuilderService) {
this.pageBuilderService = pageBuilderService;
}
public String execute(Map<String, String> map, String s, ConversionContext conversionContext) throws MacroExecutionException {
pageBuilderService.assembler().resources().requireWebResource("tutorial.tutorial:tutorial-resources");
...