I was using spring boot 2.2.4.RELEASE
and camel version 2.23.0
In order to make camel have access to properties and use them in uri routes using {{ }}
adding camel-spring-boot-starter
dependency and defining PropertySourcesPlaceholderConfigurer
, SpringCamelContext
bean was enough to make it work
@SpringBootApplication
@PropertySource(ignoreResourceNotFound = false, value= {"classpath:myProperties.properties"})
public class MyApp {
...
@Bean
public SpringCamelContext camelContext(ApplicationContext applicationContext) {
return new SpringCamelContext(applicationContext);
}
@Bean
public static PropertySourcesPlaceholderConfigurer propertyConfigInDev() {
return new PropertySourcesPlaceholderConfigurer();
}
}
--
Now, after I updated camel-spring-boot-starter
to 3.0.0-RC3
following the migration guide and after fixing the imports for the components. On runtime, camel cannot find properties and I get this:
Property with key [xxx] not found in properties from text: activemq:queue:{{xxx}}
Any Ideas what changed and why {{ }}
is not working anymore in my routes?
UPDATE 1
I updated spring boot to 2.2.6.RELEASE
and camel-spring-boot-starter
to 3.2.0
from org.apache.camel.springboot
I am still getting the same thing...
Routes are not fancy.
I need for {{ }}
to read xxx
value from myProperties.properties
Using @Value("${xxx}")
works, spring can access it, and I could pass it to the route URI String.
Accessing {{xxx}}
in camel URIs is what stopped working after the update.
@Component
public class MyRoutes extends RouteBuilder {
@Override
public void configure() throws Exception {
from("activemq:queue:{{xxx}}")
.to("activemq:topic:targetTopic");
}
}
UPDATE 2
I mirrored the test made by accepted answer. Removing SpringCamelContext
and PropertySourcesPlaceholderConfigurer
beans did the trick.
I removed the bean SpringCamelContext
and it worked. Apparently this new spring camel starter takes care of SpringCamelContext
by itself and my bean overrode the auto configuration related to camel reading properties using {{ }}
I also removed the bean PropertySourcesPlaceholderConfigurer
and @Value did not stop working.