Getting Confluence DC 8.5 license limit in a custom plugin

I’m on Confluence DC 8.5, trying to get a hold of license limit in a custom plugin. Tried getting through injection and using the Container Manager but I can’t get the license.

Using the injection, the plugin is not enabled because it can’t find the license service.

@Autowired
    public DefaultConfluenceLicenseManagementService(@ConfluenceImport LicenseService licenseService) {

        try {
            CrowdLicense license = licenseService.getLicense();
            
        } catch (Exception e) {
            LOGGER.error(e);
        }
}

Then I tried using the ContainerManager to get the license. With this one I get no error but also no license…

    @Autowired
    public DefaultConfluenceLicenseManagementService() {
        try {
            LicenseService licenseService = ((LicenseService) ContainerManager.getComponent("licenseService"));
            if (licenseService == null) {
                String message = "Failed to retrieve Confluence License Service.";
                LOGGER.error(message);               
            }
            CrowdLicense license = licenseService.getLicense();
            if (license == null) {
                String message = "Failed to retrieve Confluence License.";
                LOGGER.error(message);               
            }

        } catch (Exception e) {
            LOGGER.error(e);
        }
    }