Emowpy
Emowpy

Reputation: 115

Apache Camel fields injection

Using Apache Camel PropertyPlaceHolder I want to inject a property value in a Java Class field using Simple Expression Language:

@Simple("${properties:prop1}")
private String prop1;
@Simple("${properties:prop2}")
private String prop2;

That works fine with method's parameters:

public void test(@Simple(value = "${properties:prop}") String prop) {
    //....
}

But in java class fields I keep having null value, nothing is injected.

Any ideas please on how can I do that?

Thank you in advance.

Upvotes: 1

Views: 666

Answers (1)

Claus Ibsen
Claus Ibsen

Reputation: 56082

Using

@Simple("${properties:prop2}")
private String prop2;

On fields is not supported in Camel.

There is a JIRA ticket to support this in the future: https://issues.apache.org/jira/browse/CAMEL-3215

Upvotes: 1

Related Questions