@@ -866,6 +866,8 @@ proxy will take care of forwarding the call to the server-side object via JMS.
866
866
----
867
867
868
868
869
+
870
+
869
871
[[remoting-amqp]]
870
872
=== AMQP
871
873
Refer to the {doc-spring-amqp}/html/_reference.html#remoting[Spring AMQP Reference Document
@@ -1087,6 +1089,7 @@ Note that the `java.net` implementation for HTTP requests may raise an exception
1087
1089
accessing the status of a response that represents an error (e.g. 401). If this is an
1088
1090
issue, switch to `HttpComponentsClientHttpRequestFactory` instead.
1089
1091
====
1092
+
1090
1093
The previous example using Apache HttpComponents `HttpClient` directly rewritten to use
1091
1094
the `RestTemplate` is shown below
1092
1095
@@ -1124,6 +1127,7 @@ construct a `HttpComponentsClientHttpRequestFactory` like so:
1124
1127
RestTemplate restTemplate = new RestTemplate(requestFactory);
1125
1128
----
1126
1129
====
1130
+
1127
1131
The general callback interface is `RequestCallback` and is called when the execute
1128
1132
method is invoked.
1129
1133
@@ -2591,13 +2595,16 @@ what the <<jms-receiving-async-message-listener-adapter, `MessageListenerAdapter
2591
2595
provides).
2592
2596
2593
2597
The annotated endpoint infrastructure creates a message listener container
2594
- behind the scenes for each annotated method, using a `JmsListenerContainerFactory`. Such
2595
- container is not registered against the application context but can be easily
2598
+ behind the scenes for each annotated method, using a `JmsListenerContainerFactory`.
2599
+ Such a container is not registered against the application context but can be easily
2596
2600
located for management purposes using the `JmsListenerEndpointRegistry` bean.
2597
2601
2598
- TIP: `@JmsListener` is a _repeatable_ annotation so it is possible to associate several
2599
- JMS destinations to the same method by adding additional `@JmsListener` declaration on
2600
- it. For pre Java8 use cases, you can use `@JmsListeners`.
2602
+ [TIP]
2603
+ ====
2604
+ `@JmsListener` is a _repeatable_ annotation on Java 8, so it is possible to associate
2605
+ several JMS destinations to the same method by adding additional `@JmsListener`
2606
+ declarations to it. On Java 6 and 7, you can use the `@JmsListeners` annotation.
2607
+ ====
2601
2608
2602
2609
[[jms-annotated-support]]
2603
2610
==== Enable listener endpoint annotations
@@ -2785,8 +2792,11 @@ as follow to automatically send a response:
2785
2792
}
2786
2793
----
2787
2794
2788
- TIP: If you have several `@JmsListener`-annotated methods, you can also place the `@SendTo`
2789
- annotation at class-level to share a default reply destination.
2795
+ [TIP]
2796
+ ====
2797
+ If you have several `@JmsListener`-annotated methods, you can also place the `@SendTo`
2798
+ annotation at the class level to share a default reply destination.
2799
+ ====
2790
2800
2791
2801
If you need to set additional headers in a transport-independent manner, you could return a
2792
2802
`Message` instead, something like:
@@ -2826,7 +2836,7 @@ example can be rewritten as follows:
2826
2836
2827
2837
2828
2838
[[jms-namespace]]
2829
- === JMS Namespace Support
2839
+ === JMS namespace support
2830
2840
Spring provides an XML namespace for simplifying JMS configuration. To use the JMS
2831
2841
namespace elements you will need to reference the JMS schema:
2832
2842
@@ -6372,7 +6382,7 @@ reference is provided for managing those methods annotated with `@Scheduled`.
6372
6382
6373
6383
6374
6384
[[scheduling-annotation-support-scheduled]]
6375
- ==== The @Scheduled Annotation
6385
+ ==== The @Scheduled annotation
6376
6386
The `@Scheduled` annotation can be added to a method along with trigger metadata. For
6377
6387
example, the following method would be invoked every 5 seconds with a fixed delay,
6378
6388
meaning that the period will be measured from the completion time of each preceding
@@ -6430,7 +6440,6 @@ You can additionally use the `zone` attribute to specify the time zone in which
6430
6440
expression will be resolved.
6431
6441
====
6432
6442
6433
-
6434
6443
Notice that the methods to be scheduled must have void returns and must not expect any
6435
6444
arguments. If the method needs to interact with other objects from the Application
6436
6445
Context, then those would typically have been provided through dependency injection.
@@ -6451,7 +6460,7 @@ container and once through the `@Configurable` aspect, with the consequence of e
6451
6460
6452
6461
6453
6462
[[scheduling-annotation-support-async]]
6454
- ==== The @Async Annotation
6463
+ ==== The @Async annotation
6455
6464
The `@Async` annotation can be provided on a method so that invocation of that method
6456
6465
will occur asynchronously. In other words, the caller will return immediately upon
6457
6466
invocation and the actual execution of the method will occur in a task that has been
@@ -6495,6 +6504,14 @@ asynchronous execution so that the caller can perform other tasks prior to calli
6495
6504
}
6496
6505
----
6497
6506
6507
+ [TIP]
6508
+ ====
6509
+ `@Async` methods may not only declare a regular `java.util.concurrent.Future` return type
6510
+ but also Spring's `org.springframework.util.concurrent.ListenableFuture` or, as of Spring
6511
+ 4.2, JDK 8's `java.util.concurrent.CompletableFuture`: for richer interaction with the
6512
+ asynchronous task and for immediate composition with further processing steps.
6513
+ ====
6514
+
6498
6515
`@Async` can not be used in conjunction with lifecycle callbacks such as
6499
6516
`@PostConstruct`. To asynchronously initialize Spring beans you currently have to use
6500
6517
a separate initializing Spring bean that invokes the `@Async` annotated method on the
@@ -6583,8 +6600,11 @@ however, the exception is uncaught and cannot be transmitted. For those cases, a
6583
6600
By default, the exception is simply logged. A custom `AsyncUncaughtExceptionHandler` can
6584
6601
be defined _via_ `AsyncConfigurer` or the `task:annotation-driven` XML element.
6585
6602
6603
+
6604
+
6605
+
6586
6606
[[scheduling-task-namespace]]
6587
- === The Task Namespace
6607
+ === The task namespace
6588
6608
Beginning with Spring 3.0, there is an XML namespace for configuring `TaskExecutor` and
6589
6609
`TaskScheduler` instances. It also provides a convenient way to configure tasks to be
6590
6610
scheduled with a trigger.
0 commit comments