This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel-kamelets-examples.git
The following commit(s) were added to refs/heads/main by this push: new dea83cf CAMEL-19404: Add @Value in example dea83cf is described below commit dea83cfc18cee0e43ef8c55b4f35323c31f8e1c8 Author: Claus Ibsen <claus.ib...@gmail.com> AuthorDate: Wed May 31 19:18:57 2023 +0200 CAMEL-19404: Add @Value in example --- jbang/dependency-injection/Echo.java | 6 +++++- jbang/dependency-injection/application.properties | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/jbang/dependency-injection/Echo.java b/jbang/dependency-injection/Echo.java index 22eb915..0d79569 100755 --- a/jbang/dependency-injection/Echo.java +++ b/jbang/dependency-injection/Echo.java @@ -1,6 +1,7 @@ // camel-k: language=java import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.stereotype.Component; @@ -12,13 +13,16 @@ public class Echo { @Autowired private org.apache.camel.CamelContext context; + @Value("greeting") + private String prefix; + @Bean public CamelLogger myLogger() { return new CamelLogger("myLogger"); } public String echo(String echo) { - return echo + echo + "!! from " + context.getName(); + return prefix + " " + echo + echo + "!! from " + context.getName(); } diff --git a/jbang/dependency-injection/application.properties b/jbang/dependency-injection/application.properties new file mode 100644 index 0000000..8130d23 --- /dev/null +++ b/jbang/dependency-injection/application.properties @@ -0,0 +1 @@ +greeting = Howdy \ No newline at end of file