It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

get SchedulerService from annotated Component in Confluence

Rollin Rollin Sep 21, 2016

I have an annotated component that works well.

However I could not get access to the SchedulerService through annotation.

@Component
@ExportAsService({HealthCheckMonitorService.class})
@Named("health-check-monitor-service")
public class HealthCheckMonitorServiceImpl
        implements InitializingBean, DisposableBean, HealthCheckMonitorService {

When I tried to get the SchedulerService this way.

@ComponentImport
private SchedulerService schedulerService;

I got the following error.

did not enable within 5 seconds.The plugin should not take this long to enable. Will only attempt to load plugin for another '25' seconds.
.
.
actualEnable Unable to start the following plugins due to timeout while waiting for plugin to enable

When I tried this.

@Qualifier("schedulerService")
private SchedulerService schedulerService;

Instead I saw this result.

found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.atlassian.scheduler.SchedulerService] found for dependency:

 

My workaround was to do the following in my constructor.

@Inject
public HealthCheckMonitorServiceImpl(HealthCheckService healthCheckService){
    this.schedulerService = ComponentLocator.getComponent(SchedulerService.class);
    this.healthCheckService = healthCheckService;
}


Question: Is there any way to get that component through annotation?  It would be much more elegant. 

Note: This is Confluence 5.9.11.

1 answer

0 votes
Rollin Rollin Oct 09, 2016

This appeared to go away when I switched my pom.xml to 5.10.5 for Confluence.

 

In other words, the following works great.

@ComponentImport
private SchedulerService schedulerService;

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Published in Confluence

Confluence CVEs and common questions

Two vulnerabilities have been published for Confluence Server and Data Center recently: March 20, 2019 CVE-2019-3395 / CVE-2019-3396 April 17, 2019 CVE-2019-3398 The goal of this article is...

946 views 0 19
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you