Class CamelSetupAutoConfiguration

java.lang.Object
com.broadleafcommerce.common.messaging.autoconfigure.CamelSetupAutoConfiguration

@AutoConfigureOrder(-2147483648) @Configuration public class CamelSetupAutoConfiguration extends Object
Workaround for a camel idiosyncrasy. CamelContext must be loaded first before attempts to load CamelClusterService beans, or similar. This is because of a circular reference problem during basic Spring singleton registration that will cause the cluster view to not be registered in the context. See specifically the retrieval of CamelClusterService in org.apache.camel.main.DefaultConfigurationConfigurer#afterConfigure(org.apache.camel.CamelContext). In the failed case, the CamelClusterService will not be found in the application context. Camel appears to do nothing to enforce the ordering, and therefore this edge case can arise based on more complicated application context configurations. To mitigate, we hint to Spring to load the CamelContext early in the bean instantiation lifecycle. It is important this autoconfiguration remains isolated, and that additional beans are not added that might influence the outcome.
  • Field Details

  • Constructor Details

    • CamelSetupAutoConfiguration

      public CamelSetupAutoConfiguration()
  • Method Details

    • camelContextEarlySetup

      @Bean @DependsOn("camelContext") public Object camelContextEarlySetup(org.springframework.core.env.Environment environment)