Confluence Dependency Injection


I have a confluence page that start

public class ConfigActionSupport extends ConfluenceActionSupport {
    private static final Logger LOG = Logger.getLogger(ConfigActionSupport.class);

    private XsrfTokenService tokenService;
    private UserManager userMgr;

    public ConfigActionSupport(XsrfTokenService tokenService, UserManager userMgr){
    	this.tokenService = tokenService;
    	this.userMgr = userMgr;

When I try to load the page I get the error:

No qualifying bean of type ‘com.atlassian.sal.api.user.UserManager’ available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}

If I change the constructor to

    public ConfigActionSupport(@ComponentImport XsrfTokenService tokenService, @ComponentImport UserManager userMgr){
    	this.tokenService = tokenService;
    	this.userMgr = userMgr;

If I add @Named or @Scanned to the front it produces the error:

java.lang.IllegalArgumentException: Method ‘doDefault()’ is not defined in action ‘class com.redmoon.confluence.secureadmin.panel.ConfigActionSupport’

I have sal-api 2.6.0 in my pom.xml

What do I need to get this working?


Hello @paul.

Did you try both ways described here with all the annotations needed?

Thank you

This post might be a bit dated, but check it out if it does help. The cause, as discussed in the post, points to constructor-based injection which happens to Action subclasses.


Hi @quadr988, that was what I was using. It doesn’t work because ConfluenceActionSupport won’t allow constructor injection (see the answer by @iragudo).


Hi @iragudo, Thanks for that. I just converted to non spring injection (simpler to work with than spring, but suffers the same problem) and that gets it working.

Many thanks

1 Like