@@ -877,6 +877,8 @@ proxy will take care of forwarding the call to the server-side object via JMS.
877
877
----
878
878
879
879
880
+
881
+
880
882
[[remoting-amqp]]
881
883
=== AMQP
882
884
Refer to the {doc-spring-amqp}/html/_reference.html#remoting[Spring AMQP Reference Document
@@ -1098,6 +1100,7 @@ Note that the `java.net` implementation for HTTP requests may raise an exception
1098
1100
accessing the status of a response that represents an error (e.g. 401). If this is an
1099
1101
issue, switch to `HttpComponentsClientHttpRequestFactory` instead.
1100
1102
====
1103
+
1101
1104
The previous example using Apache HttpComponents `HttpClient` directly rewritten to use
1102
1105
the `RestTemplate` is shown below
1103
1106
@@ -1135,6 +1138,7 @@ construct a `HttpComponentsClientHttpRequestFactory` like so:
1135
1138
RestTemplate restTemplate = new RestTemplate(requestFactory);
1136
1139
----
1137
1140
====
1141
+
1138
1142
The general callback interface is `RequestCallback` and is called when the execute
1139
1143
method is invoked.
1140
1144
@@ -2602,13 +2606,16 @@ what the <<jms-receiving-async-message-listener-adapter, `MessageListenerAdapter
2602
2606
provides).
2603
2607
2604
2608
The annotated endpoint infrastructure creates a message listener container
2605
- behind the scenes for each annotated method, using a `JmsListenerContainerFactory`. Such
2606
- container is not registered against the application context but can be easily
2609
+ behind the scenes for each annotated method, using a `JmsListenerContainerFactory`.
2610
+ Such a container is not registered against the application context but can be easily
2607
2611
located for management purposes using the `JmsListenerEndpointRegistry` bean.
2608
2612
2609
- TIP: `@JmsListener` is a _repeatable_ annotation so it is possible to associate several
2610
- JMS destinations to the same method by adding additional `@JmsListener` declaration on
2611
- it. For pre Java8 use cases, you can use `@JmsListeners`.
2613
+ [TIP]
2614
+ ====
2615
+ `@JmsListener` is a _repeatable_ annotation on Java 8, so it is possible to associate
2616
+ several JMS destinations to the same method by adding additional `@JmsListener`
2617
+ declarations to it. On Java 6 and 7, you can use the `@JmsListeners` annotation.
2618
+ ====
2612
2619
2613
2620
[[jms-annotated-support]]
2614
2621
==== Enable listener endpoint annotations
@@ -2796,8 +2803,11 @@ as follow to automatically send a response:
2796
2803
}
2797
2804
----
2798
2805
2799
- TIP: If you have several `@JmsListener`-annotated methods, you can also place the `@SendTo`
2800
- annotation at class-level to share a default reply destination.
2806
+ [TIP]
2807
+ ====
2808
+ If you have several `@JmsListener`-annotated methods, you can also place the `@SendTo`
2809
+ annotation at the class level to share a default reply destination.
2810
+ ====
2801
2811
2802
2812
If you need to set additional headers in a transport-independent manner, you could return a
2803
2813
`Message` instead, something like:
@@ -2837,7 +2847,7 @@ example can be rewritten as follows:
2837
2847
2838
2848
2839
2849
[[jms-namespace]]
2840
- === JMS Namespace Support
2850
+ === JMS namespace support
2841
2851
Spring provides an XML namespace for simplifying JMS configuration. To use the JMS
2842
2852
namespace elements you will need to reference the JMS schema:
2843
2853
@@ -6497,7 +6507,7 @@ reference is provided for managing those methods annotated with `@Scheduled`.
6497
6507
6498
6508
6499
6509
[[scheduling-annotation-support-scheduled]]
6500
- ==== The @Scheduled Annotation
6510
+ ==== The @Scheduled annotation
6501
6511
The `@Scheduled` annotation can be added to a method along with trigger metadata. For
6502
6512
example, the following method would be invoked every 5 seconds with a fixed delay,
6503
6513
meaning that the period will be measured from the completion time of each preceding
@@ -6555,7 +6565,6 @@ You can additionally use the `zone` attribute to specify the time zone in which
6555
6565
expression will be resolved.
6556
6566
====
6557
6567
6558
-
6559
6568
Notice that the methods to be scheduled must have void returns and must not expect any
6560
6569
arguments. If the method needs to interact with other objects from the Application
6561
6570
Context, then those would typically have been provided through dependency injection.
@@ -6576,7 +6585,7 @@ container and once through the `@Configurable` aspect, with the consequence of e
6576
6585
6577
6586
6578
6587
[[scheduling-annotation-support-async]]
6579
- ==== The @Async Annotation
6588
+ ==== The @Async annotation
6580
6589
The `@Async` annotation can be provided on a method so that invocation of that method
6581
6590
will occur asynchronously. In other words, the caller will return immediately upon
6582
6591
invocation and the actual execution of the method will occur in a task that has been
@@ -6620,6 +6629,14 @@ asynchronous execution so that the caller can perform other tasks prior to calli
6620
6629
}
6621
6630
----
6622
6631
6632
+ [TIP]
6633
+ ====
6634
+ `@Async` methods may not only declare a regular `java.util.concurrent.Future` return type
6635
+ but also Spring's `org.springframework.util.concurrent.ListenableFuture` or, as of Spring
6636
+ 4.2, JDK 8's `java.util.concurrent.CompletableFuture`: for richer interaction with the
6637
+ asynchronous task and for immediate composition with further processing steps.
6638
+ ====
6639
+
6623
6640
`@Async` can not be used in conjunction with lifecycle callbacks such as
6624
6641
`@PostConstruct`. To asynchronously initialize Spring beans you currently have to use
6625
6642
a separate initializing Spring bean that invokes the `@Async` annotated method on the
@@ -6708,8 +6725,11 @@ however, the exception is uncaught and cannot be transmitted. For those cases, a
6708
6725
By default, the exception is simply logged. A custom `AsyncUncaughtExceptionHandler` can
6709
6726
be defined _via_ `AsyncConfigurer` or the `task:annotation-driven` XML element.
6710
6727
6728
+
6729
+
6730
+
6711
6731
[[scheduling-task-namespace]]
6712
- === The Task Namespace
6732
+ === The task namespace
6713
6733
Beginning with Spring 3.0, there is an XML namespace for configuring `TaskExecutor` and
6714
6734
`TaskScheduler` instances. It also provides a convenient way to configure tasks to be
6715
6735
scheduled with a trigger.
0 commit comments