From 021b6804cf74eb185ce56b968a2f2c280b8a3707 Mon Sep 17 00:00:00 2001 From: Dimitrios Liapis Date: Sun, 4 Nov 2018 22:17:15 +0100 Subject: [PATCH] SPR-17458 Documentation explicit Executor usage on @Async section --- src/docs/asciidoc/integration.adoc | 33 +++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/src/docs/asciidoc/integration.adoc b/src/docs/asciidoc/integration.adoc index 286f8b736734..e6224d9465d3 100644 --- a/src/docs/asciidoc/integration.adoc +++ b/src/docs/asciidoc/integration.adoc @@ -3413,7 +3413,7 @@ The following table summarizes these registration behaviors: previous instance). |=== -The values in the preceding table are defined as enums on the `RegistrationPolicy` class. +The values in the preceding table are defined as enums on the `RegistrationPolicy` class. If you want to change the default registration behavior, you need to set the value of the `registrationPolicy` property on your `MBeanExporter` definition to one of those values. @@ -6680,8 +6680,35 @@ in combination with a custom pointcut. [[scheduling-annotation-support-qualification]] ==== Executor Qualification with `@Async` -By default, when specifying `@Async` on a method, the executor that is used is the -one supplied to the "`annotation-driven`" element, as described earlier. However, you can use the `value` +As seen previously, you can enable the `@Async` annotation by adding `@EnableAsync` to any of your +`@Configuration` classes: + +==== +[source,java,indent=0] +[subs="verbatim,quotes"] +---- + @Configuration + @EnableAsync + public class AppConfig { + } +---- +==== + +Or in the case of XML configuration: + +==== +[source,xml,indent=0] +[subs="verbatim,quotes"] +---- + + + +---- +==== + +In the above XML configuration example in particular, the `"myExecutor"` executor +we are registering is the one that is getting used by default when specifying `@Async` on a method. +However, you can use the `value` attribute of the `@Async` annotation when you need to indicate that an executor other than the default should be used when executing a given method. The following example shows how to do so: