You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Claus Ibsen (Jira)" <ji...@apache.org> on 2022/09/03 14:55:00 UTC
[jira] [Resolved] (CAMEL-18236) camel-karaf - camel property not resolved
[ https://issues.apache.org/jira/browse/CAMEL-18236?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Claus Ibsen resolved CAMEL-18236.
---------------------------------
Resolution: Information Provided
> camel-karaf - camel property not resolved
> -----------------------------------------
>
> Key: CAMEL-18236
> URL: https://issues.apache.org/jira/browse/CAMEL-18236
> Project: Camel
> Issue Type: Bug
> Affects Versions: 3.15.0
> Environment: {code:java}
> {code}
> Reporter: Vincent
> Priority: Minor
>
> Hi,
>
> I have a strange comportement with camel and beans containing properties.
>
> I have a route "SimpleRoute" in which a configurable processor is injected "FakeProcessor" :
>
>
> {code:java}
> @Named
> public class SimpleRoute extends RouteBuilder {
> private final FakeProcessor fakeProcessor;
> @Inject
> public SimpleRoute(FakeProcessor fakeProcessor) {
> this.fakeProcessor = fakeProcessor;
> }
> @Override
> public void configure() throws Exception {
> from("direct:input")
> .process(fakeProcessor)
> .log("Input processed");
> }
> }{code}
>
> {code:java}
> @Named("fakeProcessor")
> @Singleton
> public class FakeProcessor implements Processor {
> private String property;
> @Inject
> public FakeProcessor(@ConfigProperty("${configuration.path}") String property) {
> this.property = property;
> }
> @Override
> public void process(Exchange exchange) throws Exception { }
> }{code}
> {code:java}
> @Named("fakeProcessor2")
> @Singleton public class FakeProcessor2 implements Processor {
> private String property;
>
> @Inject
> public FakeProcessor2(@ConfigProperty("${configuration.path}") String property) { this.property = property; }
>
> @Override
> public void process(Exchange exchange) throws Exception { }
> }
> {code}
> The property "${configuration.path}" is interpreted in bean FakeProcessor2 but not in bean FakeProcessor (which is injected to my route).
>
> Here is the blueprint file :
>
> {code:java}
> <?xml version="1.0" encoding="UTF-8"?>
> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:camel="http://camel.apache.org/schema/blueprint"
> xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0" xsi:schemaLocation="
> http://www.osgi.org/xmlns/blueprint/v1.0.0 https://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">
> <cm:property-placeholder id="voo.esb.services.contactoccurence.sendemail" persistent-id="voo.esb.services.contactoccurence.sendemail">
> <cm:default-properties>
> <cm:property name="camel.context.trace" value="false"/>
> <cm:property name="consumer.name" value="ContactOccurenceSendEmail"/>
> <cm:property name="configuration.path" value="${karaf.base}/etc/voo.esb.services.contactoccurence.sendemail.yml"/>
> </cm:default-properties>
> </cm:property-placeholder>
> <camel:camelContext id="contactoccurenceSendEmailCamelContext" trace="{{camel.context.trace}}" autoStartup="true">
> <camel:propertyPlaceholder id="propertyPlaceholder" location="blueprint:voo.esb.services.contactoccurence.sendemail"/>->
> <camel:routeBuilder ref="simpleRoute"/>
> </camel:camelContext>
>
> <bean id="fakeProcessor" class="be.voo.esb.services.contactoccurence.sendemail.processor.FakeProcessor">
> <argument value="${configuration.path}"/>
> </bean>
> <bean id="fakeProcessor2" class="be.voo.esb.services.contactoccurence.sendemail.processor.FakeProcessor2">
> <argument value="${configuration.path}"/>
> </bean>
> <bean id="simpleRoute" class="be.voo.esb.services.contactoccurence.sendemail.SimpleRoute" scope="prototype">
> <argument ref="fakeProcessor"/>
> </bean>
> </blueprint> {code}
>
> Do you have any ideas?
>
> Thank you for your help!
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)