Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
a70a8635
Commit
a70a8635
authored
Jun 14, 2016
by
Johnny Lim
Committed by
Stephane Nicoll
Jun 14, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Polish
Closes gh-6155
parent
ed96d142
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
20 additions
and
30 deletions
+20
-30
spring-boot-features.adoc
spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc
+5
-5
AnnotationsPropertySourceTests.java
...oconfigure/properties/AnnotationsPropertySourceTests.java
+1
-3
MockitoPostProcessor.java
...ramework/boot/test/mock/mockito/MockitoPostProcessor.java
+2
-2
RestTemplateBuilder.java
.../springframework/boot/web/client/RestTemplateBuilder.java
+4
-4
RootUriTemplateHandler.java
...ringframework/boot/web/client/RootUriTemplateHandler.java
+3
-3
BasicAuthorizationInterceptorTests.java
...k/boot/web/client/BasicAuthorizationInterceptorTests.java
+1
-1
RestTemplateBuilderTests.java
...ngframework/boot/web/client/RestTemplateBuilderTests.java
+4
-12
No files found.
spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc
View file @
a70a8635
...
...
@@ -4253,7 +4253,7 @@ reached.
[[boot-features-restclient]]
== Calling REST services
If you need to call remote REST services from your application, you can use Spring
Framework's `RestTemplate` class. Since `RestTemplate` instances often need
s
to be
Framework's `RestTemplate` class. Since `RestTemplate` instances often need to be
customized before being used, Spring Boot does not provide any single auto-configured
`RestTemplate` bean. It does, however, auto-configure a `RestTemplateBuilder` which can be
used to create `RestTemplate` instances when needed. The auto-configured
...
...
@@ -4273,7 +4273,7 @@ Here's a typical example:
this.restTemplate = restTemplateBuilder.build();
}
public
String
someRestCall(String name) {
public
Details
someRestCall(String name) {
return this.restTemplate.getForObject("/{name}/details", Details.class, name);
}
...
...
@@ -5035,7 +5035,7 @@ database you can use the `@AutoConfigureTestDatabase` annotation:
[[boot-features-testing-spring-boot-applications-testing-autoconfigured-rest-client]]
==== Auto-configured REST clients
Use `@RestClientTest` annotation can be used if you want to test REST clients. By default
it will auto
configure Jackson and GSON support, configure a `RestTemplateBuilder` and
it will auto
-
configure Jackson and GSON support, configure a `RestTemplateBuilder` and
add support for `MockRestServiceServer`. The specific beans that you want to test should
be specified using `value` or `components` attribute of `@RestClientTest`:
...
...
@@ -5047,7 +5047,7 @@ be specified using `value` or `components` attribute of `@RestClientTest`:
public class ExampleRestClientTest {
@Autowired
private
My
Service service;
private
RemoteVehicleDetails
Service service;
@Autowired
private MockRestServiceServer server;
...
...
@@ -5057,7 +5057,7 @@ be specified using `value` or `components` attribute of `@RestClientTest`:
throws Exception {
this.server.expect(requestTo("/greet/details"))
.andRespond(withSuccess("hello", MediaType.TEXT_PLAIN));
String greeting
= this.service.callRestService();
String greeting = this.service.callRestService();
assertThat(greeting).isEqualTo("hello");
}
...
...
spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/properties/AnnotationsPropertySourceTests.java
View file @
a70a8635
...
...
@@ -348,9 +348,7 @@ public class AnnotationsPropertySourceTests {
static
@interface
AttributeWithAliasAnnotation
{
@AliasFor
(
annotation
=
AliasedAttributeAnnotation
.
class
,
attribute
=
"value"
)
String
value
()
default
"foo"
;
String
value
()
default
"foo"
;
String
someOtherAttribute
()
default
"shouldNotBeMapped"
;
...
...
spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/MockitoPostProcessor.java
View file @
a70a8635
...
...
@@ -416,7 +416,7 @@ public class MockitoPostProcessor extends InstantiationAwareBeanPostProcessorAda
/**
* {@link BeanPostProcessor} to handle {@link SpyBean} definitions. Registered as a
* separate processor so that it can ordered above AOP post processors.
* separate processor so that it can
be
ordered above AOP post processors.
*/
static
class
SpyPostProcessor
extends
InstantiationAwareBeanPostProcessorAdapter
implements
PriorityOrdered
{
...
...
@@ -466,7 +466,7 @@ public class MockitoPostProcessor extends InstantiationAwareBeanPostProcessorAda
}
/**
* A
n
registered field item.
* A registered field item.
*/
private
static
class
RegisteredField
{
...
...
spring-boot/src/main/java/org/springframework/boot/web/client/RestTemplateBuilder.java
View file @
a70a8635
...
...
@@ -285,7 +285,7 @@ public class RestTemplateBuilder {
}
/**
* Set the {@link
HttpMessageConverter HttpMessageConvert
ers} that should be applied
* Set the {@link
RestTemplateCustomizer RestTemplateCustomiz
ers} that should be applied
* to the {@link RestTemplate}. Customizers are applied in the order that they were
* added after builder configuration has been applied. Setting this value will replace
* any previously configured customizers.
...
...
@@ -301,7 +301,7 @@ public class RestTemplateBuilder {
}
/**
* Set the {@link
HttpMessageConverter HttpMessageConvert
ers} that should be applied
* Set the {@link
RestTemplateCustomizer RestTemplateCustomiz
ers} that should be applied
* to the {@link RestTemplate}. Customizers are applied in the order that they were
* added after builder configuration has been applied. Setting this value will replace
* any previously configured customizers.
...
...
@@ -321,7 +321,7 @@ public class RestTemplateBuilder {
}
/**
* Add {@link
HttpMessageConverter HttpMessageConvert
ers} that should be applied to
* Add {@link
RestTemplateCustomizer RestTemplateCustomiz
ers} that should be applied to
* the {@link RestTemplate}. Customizers are applied in the order that they were added
* after builder configuration has been applied.
* @param restTemplateCustomizers the customizers to add
...
...
@@ -336,7 +336,7 @@ public class RestTemplateBuilder {
}
/**
* Add {@link
HttpMessageConverter HttpMessageConvert
ers} that should be applied to
* Add {@link
RestTemplateCustomizer RestTemplateCustomiz
ers} that should be applied to
* the {@link RestTemplate}. Customizers are applied in the order that they were added
* after builder configuration has been applied.
* @param customizers the customizers to add
...
...
spring-boot/src/main/java/org/springframework/boot/web/client/RootUriTemplateHandler.java
View file @
a70a8635
...
...
@@ -26,7 +26,7 @@ import org.springframework.web.util.DefaultUriTemplateHandler;
import
org.springframework.web.util.UriTemplateHandler
;
/**
* {@link UriTemplateHandler} to set the root for URI that start with {@code '/'}.
* {@link UriTemplateHandler} to set the root for URI that start
s
with {@code '/'}.
*
* @author Phillip Webb
* @since 1.4.0
...
...
@@ -44,7 +44,7 @@ public class RootUriTemplateHandler implements UriTemplateHandler {
/**
* Create a new {@link RootUriTemplateHandler} instance.
* @param rootUri the root URI to used to prefix relative URLs
* @param rootUri the root URI to
be
used to prefix relative URLs
*/
public
RootUriTemplateHandler
(
String
rootUri
)
{
this
(
rootUri
,
new
DefaultUriTemplateHandler
());
...
...
@@ -52,7 +52,7 @@ public class RootUriTemplateHandler implements UriTemplateHandler {
/**
* Create a new {@link RootUriTemplateHandler} instance.
* @param rootUri the root URI to used to prefix relative URLs
* @param rootUri the root URI to
be
used to prefix relative URLs
* @param handler the delegate handler
*/
public
RootUriTemplateHandler
(
String
rootUri
,
UriTemplateHandler
handler
)
{
...
...
spring-boot/src/test/java/org/springframework/boot/web/client/BasicAuthorizationInterceptorTests.java
View file @
a70a8635
...
...
@@ -54,7 +54,7 @@ public class BasicAuthorizationInterceptorTests {
@Test
public
void
createWhenPasswordIsNullShouldUseEmptyPassword
()
throws
Exception
{
BasicAuthorizationInterceptor
interceptor
=
new
BasicAuthorizationInterceptor
(
"username"
,
""
);
"username"
,
null
);
assertThat
(
interceptor
).
extracting
(
"password"
).
containsExactly
(
""
);
}
...
...
spring-boot/src/test/java/org/springframework/boot/web/client/RestTemplateBuilderTests.java
View file @
a70a8635
...
...
@@ -264,22 +264,14 @@ public class RestTemplateBuilderTests {
}
@Test
public
void
customizersWhenNullArrayShouldThrowException
()
throws
Exception
{
this
.
thrown
.
expect
(
IllegalArgumentException
.
class
);
this
.
thrown
.
expectMessage
(
"Customizers must not be null"
);
RestTemplateCustomizer
[]
customizers
=
null
;
this
.
builder
.
customizers
(
customizers
);
}
@Test
public
void
customizersWhenConvertersAreNullShouldThrowException
()
throws
Exception
{
public
void
customizersWhenCustomizersAreNullShouldThrowException
()
throws
Exception
{
this
.
thrown
.
expect
(
IllegalArgumentException
.
class
);
this
.
thrown
.
expectMessage
(
"RestTemplateCustomizers must not be null"
);
this
.
builder
.
customizers
((
RestTemplateCustomizer
[])
null
);
}
@Test
public
void
customizersCollectionWhenC
onvert
ersAreNullShouldThrowException
()
public
void
customizersCollectionWhenC
ustomiz
ersAreNullShouldThrowException
()
throws
Exception
{
this
.
thrown
.
expect
(
IllegalArgumentException
.
class
);
this
.
thrown
.
expectMessage
(
"RestTemplateCustomizers must not be null"
);
...
...
@@ -318,7 +310,7 @@ public class RestTemplateBuilderTests {
}
@Test
public
void
additionalCustomizersWhenC
onvert
ersAreNullShouldThrowException
()
public
void
additionalCustomizersWhenC
ustomiz
ersAreNullShouldThrowException
()
throws
Exception
{
this
.
thrown
.
expect
(
IllegalArgumentException
.
class
);
this
.
thrown
.
expectMessage
(
"RestTemplateCustomizers must not be null"
);
...
...
@@ -326,7 +318,7 @@ public class RestTemplateBuilderTests {
}
@Test
public
void
additionalCustomizersCollectionWhenC
onvert
ersAreNullShouldThrowException
()
public
void
additionalCustomizersCollectionWhenC
ustomiz
ersAreNullShouldThrowException
()
throws
Exception
{
this
.
thrown
.
expect
(
IllegalArgumentException
.
class
);
this
.
thrown
.
expectMessage
(
"RestTemplateCustomizers must not be null"
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment