Skip to content

Commit 09b19d7

Browse files
committed
Update RestTemplate Javadoc
Closes gh-29311
1 parent 8ade083 commit 09b19d7

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

spring-web/src/main/java/org/springframework/http/client/support/InterceptingHttpAccessor.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2020 the original author or authors.
2+
* Copyright 2002-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -54,6 +54,10 @@ public abstract class InterceptingHttpAccessor extends HttpAccessor {
5454
* Set the request interceptors that this accessor should use.
5555
* <p>The interceptors will get immediately sorted according to their
5656
* {@linkplain AnnotationAwareOrderComparator#sort(List) order}.
57+
* <p><strong>Note:</strong> This method does not support concurrent changes,
58+
* and in most cases should not be called after initialization on startup.
59+
* See also related note on {@link org.springframework.web.client.RestTemplate}
60+
* regarding concurrent configuration changes.
5761
* @see #getRequestFactory()
5862
* @see AnnotationAwareOrderComparator
5963
*/

spring-web/src/main/java/org/springframework/web/client/RestTemplate.java

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2021 the original author or authors.
2+
* Copyright 2002-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -68,11 +68,17 @@
6868
/**
6969
* Synchronous client to perform HTTP requests, exposing a simple, template
7070
* method API over underlying HTTP client libraries such as the JDK
71-
* {@code HttpURLConnection}, Apache HttpComponents, and others.
71+
* {@code HttpURLConnection}, Apache HttpComponents, and others. RestTemplate
72+
* offers templates for common scenarios by HTTP method, in addition to the
73+
* generalized {@code exchange} and {@code execute} methods that support of
74+
* less frequent cases.
7275
*
73-
* <p>The RestTemplate offers templates for common scenarios by HTTP method, in
74-
* addition to the generalized {@code exchange} and {@code execute} methods that
75-
* support of less frequent cases.
76+
* <p>RestTemplate is typically used as a shared component. However, its
77+
* configuration does not support concurrent modification, and as such its
78+
* configuration is typically prepared on startup. If necessary, you can create
79+
* multiple, differently configured RestTemplate instances on startup. Such
80+
* instances may use the same the underlying {@link ClientHttpRequestFactory}
81+
* if they need to share HTTP client resources.
7682
*
7783
* <p><strong>NOTE:</strong> As of 5.0 this class is in maintenance mode, with
7884
* only minor requests for changes and bugs to be accepted going forward. Please,

0 commit comments

Comments
 (0)