I’m running into an issue with a module that registers a spring aop aspect and it fails to start with a BeanCurrentlyInCreationException
, this is because
AdministrationServiceImpl has an eventListeners property which is wired into it via spring and at the same time it is registered as one of the listeners. I’m not sure why it’s showing up now but it’s clearly a circular dependency, it’s bad practice and we should fix it.
My proposed solution is to not wire the event listeners property, we should just look it up from the application context using Context.getRegisteredBeans(EventListeners.class)
where it is used in AdminService, of course we can cache it in the AdminService instance so that it’s only looked up once.
Other ideas are welcome.