I have a multi subproject spring boot 3.0 application built by gradle. In modules A and B I have beans with the annotations
@Bean
@ConditionalOnBean(jakarta.jms.ConnectionFactory.class)
declared.
The actual app subproject containing the runnable boot application depends on both of these modules. Also module B depends on A. And app also has a runtimeOnly dependency on apache artemis to let spring boots ArtemisAutoConfiguration do the configuration of the jms connection factory via ArtemisAutoConfiguration.
However when I look at the condition evaluation report after the application started, I see that the condition did not match for the bean defined in subproject A but it did match for the bean defined in subproject B. Since ConditionalOnBean is evaluated during bean registration phase I suppose the bean definition for artemis is registered only after the bean in subproject A is registered but before the one in subproject B.
Can anyone explain what determines this order?
I already had a look at BOOT-INF/classpath.idx in the spring boot jar. But this shows A and B before any artemis and spring-boot-autoconfiguration entries. So I suppose it's not that.
NOTE: yes, using @AutoConfigureAfter(ArtemisAutoConfiguration.class) on the auto configuration of subproject A fixes this. I'm just curious to know why this was actually necessary to apply.