This is an automated email from the ASF dual-hosted git repository. orpiske pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git
commit c181ac80aa847b1bf3f6dfb70d4bed191f2cf86a Author: Otavio Rodolfo Piske <angusyo...@gmail.com> AuthorDate: Wed Feb 21 18:30:20 2024 +0100 CAMEL-20410: documentation fixes for camel-spring - Fixed samples - Fixed grammar and typos - Fixed punctuation - Added and/or fixed links - Converted to use tabs --- .../camel-spring/src/main/docs/spel-language.adoc | 22 ++++++------ .../src/main/docs/spring-event-component.adoc | 7 ++-- .../camel-spring/src/main/docs/spring-summary.adoc | 40 ++++++++++++---------- 3 files changed, 36 insertions(+), 33 deletions(-) diff --git a/components/camel-spring/src/main/docs/spel-language.adoc b/components/camel-spring/src/main/docs/spel-language.adoc index 2e98236dc04..ccad88b2103 100644 --- a/components/camel-spring/src/main/docs/spel-language.adoc +++ b/components/camel-spring/src/main/docs/spel-language.adoc @@ -17,8 +17,8 @@ to be used as an Expression or Predicate in the DSL or XML Configuration. [NOTE] ==== -It is recommended to use SpEL in Spring runtimes. However, you can -use SpEL in other runtimes (there are some functionality which SpEL can only do in a Spring runtime) +It is recommended to use SpEL in Spring runtimes. +Although you can use SpEL in other runtimes, there is some functionality that SpEL can only do in a Spring runtime. ==== == SpEL Options @@ -79,10 +79,10 @@ from("direct:foo") SpEL expressions need to be surrounded by `#{` `}` delimiters since expression templating is enabled. This allows you to combine SpEL -expressions with regular text and use this as extremely lightweight +expressions with regular text and use this as an extremely lightweight template language. -For example if you construct the following route: +For example, if you construct the following route: [source,java] ---- @@ -94,8 +94,8 @@ from("direct:example") In the route above, notice `spel` is a static method which we need to import from `org.apache.camel.language.spel.SpelExpression.spel`, as we use `spel` as an Expression passed in as a parameter -to the `setBody` method. Though if we use the fluent API we can do this -instead: +to the `setBody` method. +Though if we use the fluent API, we can do this instead: [source,java] ---- @@ -105,10 +105,10 @@ from("direct:example") ---- Notice we now use the `spel` method from the `setBody()` method. And -this does not require us to static import the `spel` method. +this does not require us to statically import the `spel` method. Then we send a message with the string "World" in the body, and a header -"dayOrNight" with value "day": +`dayOrNight` with value `day`: [source,java] ---- @@ -121,7 +121,7 @@ day"_ === Bean integration You can reference beans defined in the xref:manual::registry.adoc[Registry] -in your SpEL expressions. For example if you have a bean named "foo" +in your SpEL expressions. For example, if you have a bean named "foo" registered in the Spring `ApplicationContext`. You can then invoke the "bar" method on this bean like this: @@ -133,10 +133,10 @@ can then invoke the "bar" method on this bean like this: == Loading script from external resource -You can externalize the script and have Camel load it from a resource +You can externalize the script and have Apache Camel load it from a resource such as `"classpath:"`, `"file:"`, or `"http:"`. This is done using the following syntax: `"resource:scheme:location"`, -e.g. to refer to a file on the classpath you can do: +e.g., to refer to a file on the classpath you can do: [source,java] ---- diff --git a/components/camel-spring/src/main/docs/spring-event-component.adoc b/components/camel-spring/src/main/docs/spring-event-component.adoc index 0a1bd1a341d..da73be882ff 100644 --- a/components/camel-spring/src/main/docs/spring-event-component.adoc +++ b/components/camel-spring/src/main/docs/spring-event-component.adoc @@ -20,7 +20,7 @@ The Spring Event component provides access to the Spring `ApplicationEvent` objects to a Spring `ApplicationContext` or to consume them. You can then use xref:eips:enterprise-integration-patterns.adoc[Enterprise Integration -Patterns] to process them such as xref:eips:filter-eip.adoc[Message +Patterns] to process them, such as xref:eips:filter-eip.adoc[Message Filter]. == URI format @@ -29,8 +29,9 @@ Filter]. spring-event://default[?options] -------------------------------- -Note, at the moment there are no options for this component. That can -easily change in future releases, so please check back. +[NOTE] +At the moment, there are no options for this component. +That may change in future releases, so please check back. // component-configure options: START diff --git a/components/camel-spring/src/main/docs/spring-summary.adoc b/components/camel-spring/src/main/docs/spring-summary.adoc index 376d097d267..566172bc3c8 100644 --- a/components/camel-spring/src/main/docs/spring-summary.adoc +++ b/components/camel-spring/src/main/docs/spring-summary.adoc @@ -23,7 +23,7 @@ with any bean defined in a Spring ApplicationContext * Camel uses Spring Transactions as the default transaction handling in components like xref:jms-component.adoc[JMS] and xref:jms-component.adoc[JPA] * Camel integrates with various Spring helper classes; such as providing -Type Converter support for Spring Resources etc +Type Converter support for Spring Resources, etc. * Allows you to reuse the Spring Testing framework to simplify your unit and integration testing using xref:eips:enterprise-integration-patterns.adoc[Enterprise Integration @@ -108,8 +108,8 @@ discovery and initialization of routes in given packages. This is configured by adding tags to the camel context in your spring context definition, specifying the packages to be recursively searched for `RouteBuilder` implementations. To use this feature, requires a -`<package></package>` tag specifying a comma -separated list of packages that should be searched e.g. +`<package></package>` tag specifying a comma-separated list of +packages that should be searched e.g. [source,xml] ---- @@ -120,17 +120,18 @@ separated list of packages that should be searched e.g. WARNING: Use caution when specifying the package name as `org.apache.camel` or a -sub package of this. This causes Camel to search in its own packages for -your routes which could cause problems. +subpackage of this. +This causes Camel to search in its own packages for +your routes, which could cause problems. [NOTE] ==== *Will ignore already instantiated classes* -The `<package>` and `<packageScan>` will skip all classes which have already -been created by Spring etc. So if you define a route builder as a spring -bean tag then that class will be skipped. You can include those beans +The `<package>` and `<packageScan>` will skip all classes that Spring has already +created etc. So if you define a route builder as a spring +bean tag, then that class will be skipped. You can include those beans using `<routeBuilder ref="theBeanId"/>` or the `<contextScan>` feature. ==== @@ -155,7 +156,7 @@ applied to the fully qualified names of the discovered classes. e.g. -------------------------------------------------------------- Exclude patterns are applied before the include patterns. If no include -or exclude patterns are defined then all the Route classes discovered in +or exclude patterns are defined, then all the Route classes discovered in the packages will be returned. In the above example, camel will scan all the `org.example.routes` @@ -189,7 +190,7 @@ but not match org.simple.PrecludedRoute === Using contextScan -You can allow Camel to scan the container context, e.g. the Spring +You can allow Camel to scan the container context, e.g., the Spring `ApplicationContext` for route builder instances. This allows you to use the Spring `<component-scan>` feature and have Camel pickup any `RouteBuilder` instances which were created by Spring in its scan process. @@ -212,9 +213,9 @@ public class MyRoute extends SpringRouteBuilder { You can also use the ant style for inclusion and exclusion, as mentioned above in the `<packageScan>` documentation. -== How do I import routes from other XML files +== How do I import routes from other XML files? -When defining routes in Camel using Spring XML you may want to define some routes in other XML files. +When defining routes in Camel using Spring XML, you may want to define some routes in other XML files. For example, you may have many routes, and it may help to maintain the application if some routes are in separate XML files. You may also want to store common and reusable routes in other XML files, which @@ -249,7 +250,7 @@ a couple of routes as shown: <from uri="direct:start"/> <to uri="mock:result"/> </route> - <!-- and another route, you can have as many your like --> + <!-- and another route, you can have as many you like --> <route id="bar"> <from uri="direct:bar"/> <to uri="mock:bar"/> @@ -273,7 +274,7 @@ to import the `myCoolRoute.xml` file. + <!-- refer to a given route to be used --> <routeContextRef ref="myCoolRoutes"/> - <!-- we can of course still use routes inside camelContext --> + <!-- we can still use routes inside camelContext --> <route id="inside"> <from uri="direct:inside"/> <to uri="mock:inside"/> @@ -289,13 +290,14 @@ You can have as many `<routeContextRef/>` as you like. *Reusable routes* The routes defined in `<routeContext/>` can be reused by multiple -`<camelContext/>`. However, it is only the definition which is reused. At -runtime each CamelContext will create its own instance of the route +`<camelContext/>`. +However, it is only the definition that is reused. +At runtime, each CamelContext will create its own instance of the route based on the definition. === Test time exclusion. -At test time it is often desirable to be able to selectively exclude +At test time, it is often desirable to be able to selectively exclude matching routes from being initialized that are not applicable or useful to the test scenario. For instance, you might have a spring context file `routes-context.xml` and three Route builders `RouteA`, `RouteB` and `RouteC` in @@ -319,7 +321,7 @@ public class RouteAandRouteBOnlyTest extends SpringTestSupport { } ---------------------------------------------------------------- -In order to hook into the camelContext initialization by spring to +To hook into the camelContext initialization by spring to exclude the class `MyExcludedRouteBuilder`, we need to intercept the spring context creation. When overriding createApplicationContext to create the spring context, we call the `getRouteExcludingApplicationContext()` method @@ -408,7 +410,7 @@ Integration] for further injections. == Integration Testing -To avoid a hung route when testing using Spring Transactions see the +To avoid a hung route when testing using Spring Transactions, see the note about Spring Integration Testing under Transactional Client. == Cron Component Support