I was creating a confluence server plugin. I want to use the ‘getGroupsWithPermissions’ that belongs to the ‘SpacePermissionManager’ package. But, when I tried to use the fucntion, it gave me the below error:
Non-static method 'getGroupsWithPermissions(com.atlassian.confluence.spaces.@org.checkerframework.checker.nullness.qual.Nullable Space)' cannot be referenced from a static context
How can I solve this one?
Please consult this documentation:
Specifically, you’ll want to follow the section on Constructor-based injection (v2 plugins).
Confluence is built around Spring, an open-source component framework for Java.
If you are familiar with Spring, then you just need to know that Confluence plugin modules (and their implementing classes) are autowired by name. Thus, if you want to access a Confluence component from your plugin, just include the appropriate setter method in your implementing class or use constructor injection with javax or Spring annotations (for v2 plugins).
If you want to write Confluence plugins but you are not familiar with Spring, the rest of this page will give you information on how to make your plugin interact with Confluence.