Spring Java Config: Requested bean is currently in creation

Hi,

A while ago we switched to the Spring Java Config: Spring Java configuration of app components

We got it working, but sometimes when we want to add an additional Class that depends on one of our activeObject Beans, we get the following error:

Requested bean is currently in creation: Is there an unresolvable circular reference?

As far as I can see, we don’t have a circular reference, but a lot of classes that depend on a active Object class. Does anyone had simmilar issues and know a way to resolve them?

the beans looks something like this

	@Bean
	public GlobalStore globalStore(final ActiveObjects activeObjects) {
		return new GlobalStore(activeObjects);
	}

	@Bean
	public DummyStore dummyStore(final ActiveObjects activeObjects) {
		return new DummyStore(activeObjects);
	}

	@Bean
	public DummyManager dummyManager(GlobalStore globalStore, DummyStore dummyStore) {
		return new dummyManager(globalStore, dummyStore);
	}

	@Bean
	public JobLauncher JobLauncher(final EventPublisher eventPublisher, final SchedulerService schedulerService, DummyManager) {
		return new JobLauncher(eventPublisher, schedulerService, dummyManager);
	}

	@Bean
	public FactoryBean<ServiceRegistration> jobLauncher(JobLauncher jobLauncher) {
		return exportOsgiService(jobLauncher, as(LifecycleAware.class));
	}

Hello I had a similar issue - could you try it like this:

    @Bean
	public FactoryBean<ServiceRegistration> jobLauncher(final EventPublisher eventPublisher, final SchedulerService schedulerService, DummyManagerr) {
		return exportOsgiService(new JobLauncher(eventPublisher, schedulerService, dummyManager), as(LifecycleAware.class));
	}

And maybe remove the
public JobLauncher JobLauncher(

if you only export it as a service.

Thanks for the reply, I will try it out the next time we have these issues.
It is fortunate that this side of our code does not need to be updated regularly