RestConfiguration fail to get property value in camel spring-boot application

Solution Verified - Updated -

Issue

  • When we want to make restConfiguration port attribute in RestDSL configurable through application properties it fail to start container with the following error:
14:21:12.321 [main] WARN  o.s.b.c.e.AnnotationConfigEmbeddedWebApplicationContext - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'XXXCamel': Invocation of init method failed; nested exception is org.apache.camel.RuntimeCamelException: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'properties' defined in class path resource [org/apache/camel/spring/boot/CamelAutoConfiguration.class]: Unsatisfied dependency expressed through method 'properties' parameter 0; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean found for dependency [org.apache.camel.CamelContext]: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
14:21:12.321 [main] INFO  o.a.catalina.core.StandardService - Stopping service Tomcat
14:21:12.400 [main] WARN  o.s.boot.SpringApplication - Error handling failed (Error creating bean with name 'XXXCamel': Invocation of init method failed; nested exception is java.lang.IllegalStateException: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@26f724 has not been refreshed yet)
14:21:12.557 [main] ERROR o.s.b.d.LoggingFailureAnalysisReporter - 

***************************
APPLICATION FAILED TO START
***************************

Description:

Parameter 0 of method properties in org.apache.camel.spring.boot.CamelAutoConfiguration required a bean of type 'org.apache.camel.CamelContext' that could not be found.
    - Bean method 'camelContext' in 'CamelAutoConfiguration' not loaded because @ConditionalOnMissingBean (types: org.apache.camel.CamelContext; SearchStrategy: all) found bean 'XXXCamel'


Action:

Consider revisiting the conditions above or defining a bean of type 'org.apache.camel.CamelContext' in your configuration.
  • The port attribute of element can't be replaced by property placeholder in spring boot.
<restConfiguration component="restlet" contextPath="/" port="{{{restlet.port}}}">
    <dataFormatProperty key="prettyPrint" value="true"/>
</restConfiguration>

Environment

  • OpenShift Container 3.x
  • FIS 2.0 (Spring Boot)
    • camel version 2.18.1.redhat-000012

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In