You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2022/03/14 06:11:04 UTC

[camel] 01/04: CAMEL-17571: camel-jbang - docs

This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch CAMEL-17571
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 3a50ddc48c4b8e9708ee356f244dcfa973f94ad2
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Sun Mar 13 10:58:51 2022 +0100

    CAMEL-17571: camel-jbang - docs
---
 .../modules/ROOT/pages/camel-jbang.adoc            | 34 ++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/docs/user-manual/modules/ROOT/pages/camel-jbang.adoc b/docs/user-manual/modules/ROOT/pages/camel-jbang.adoc
index 4a58944..3f13e26 100644
--- a/docs/user-manual/modules/ROOT/pages/camel-jbang.adoc
+++ b/docs/user-manual/modules/ROOT/pages/camel-jbang.adoc
@@ -238,6 +238,40 @@ curl http://localhost:8080/hello
 Hello World%
 ----
 
+=== Dependency Injection in Java classes
+
+When running Camel applications with camel-jbang, then the runtime is `camel-main` based. This means
+there is no Spring Boot, or Quarkus available. However, we have added support for using annotation
+based dependency injection in Java classes.
+
+==== Using Camel dependency injection
+
+You can use the following Camel annotations (they work on all runtimes):
+
+- `@BindToRegistry` on class level to create an instance of the class and register in the xref:registry.adoc[Registry].
+- `@BeanInject` to dependency inject a bean on a class field.
+- `@PropertyInject` to inject a xref:using-propertyplaceholder.adoc[property placeholder]. Such as a property defined in `application.properties`.
+- `@BindToRegistry` on a method to create a bean by invoking the method.
+- `@Converter` on class level to auto-register the xref:type-converter.adoc[type converters] from the class.
+
+==== Using Spring Boot dependency injection
+
+You can use the following Spring Boot annotations:
+
+- `@Component` or `@Service` on class level to create an instance of the class and register in the xref:registry.adoc[Registry].
+- `@Autowired` to dependency inject an bean on a class field. `@Qualifier` can be used to specify the bean id.
+- `@Value` to inject a xref:using-propertyplaceholder.adoc[property placeholder]. Such as a property defined in `application.properties`.
+- `@Bean` on a method to create a bean by invoking the method.
+
+==== Using Quarkus injection
+
+You can use the following Quarkus annotations:
+
+- `@ApplicationScoped` or `@Single` on class level to create an instance of the class and register in the xref:registry.adoc[Registry]. `@Named` can be used to specify the bean id.
+- `@Inject` to dependency inject an bean on a class field. `@Named` can be used to specify the bean id.
+- `@ConfigProperty` to inject a xref:using-propertyplaceholder.adoc[property placeholder]. Such as a property defined in `application.properties`.
+- `@Produces` on a method to create a bean by invoking the method. `@Named` can be used to specify the bean id.
+
 === Debugging
 
 You can debug both camel@apache/camel and your integration scripts by making use of the `--debug` flag provided by JBang: