How to import BoardAdminService (greenhopper)

Hi!
I’m trying to import BoardAdminService

@Slf4j
public class IsCurrentUserAdminOrInSavedGroup implements Condition {
    private final JiraAuthenticationContext authenticationContext;
    private final BoardAdminService boardAdminService;
    private final TeamGroupConfigurationService TeamGroupConfigurationService;
    private final GroupManager groupManager;
    private final GlobalPermissionManager globalPermissionManager;

    @Autowired
    public IsCurrentUserAdminOrInSavedGroup(TeamGroupConfigurationService TeamGroupConfigurationService,
                                            @ComponentImport JiraAuthenticationContext authenticationContext,
                                            @ComponentImport BoardAdminService boardAdminService)
     {
        this.TeamGroupConfigurationService = TeamGroupConfigurationService;
        this.groupManager = ComponentAccessor.getGroupManager();
        this.globalPermissionManager = ComponentAccessor.getGlobalPermissionManager();
        this.authenticationContext = authenticationContext;
        this.boardAdminService = boardAdminService;


    }

When I run the plugin I get an error

Plugin Installer ERROR      [c.a.p.osgi.factory.OsgiPlugin] Plugin 'XXX' never resolved service '&boardAdminService' with filter '(&(objectClass=com.atlassian.greenhopper.service.rapid.view.BoardAdminService)(objectClass=com.atlassian.greenhopper.service.rapid.view.BoardAdminService))'

1 Like

You can Autowire just a few beans from Greenhopper.
To make something more you have to load beans through OSGI ApplicationContext dedicated to GreenHopper plugin:

Please refer to my comment here: No bean named 'rapidViewServiceImpl' - #2 by RomaBubyakin
You can use it like:

BoardAdminService boardAdminService = getGreenHopperBean(BoardAdminService .class);
boardAdminService....

However, BoardAdminService requires RapidView entries, so you may consider getting RapidViewService.

It also might be interesting to you to see all beans in the ghAppContext so I’m attaching the list of them
GH_beans_full_list.txt (19.5 KB)