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
5a1741e2
Commit
5a1741e2
authored
Aug 23, 2016
by
Andy Wilkinson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve documentation of when TestRestTemplate is auto-configured
Closes gh-6729
parent
9e2dcbbe
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
4 deletions
+6
-4
spring-boot-features.adoc
spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc
+4
-3
SpringBootTest.java
...org/springframework/boot/test/context/SpringBootTest.java
+2
-1
No files found.
spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc
View file @
5a1741e2
...
@@ -5488,9 +5488,10 @@ public class MyTest {
...
@@ -5488,9 +5488,10 @@ public class MyTest {
}
}
----
----
If you are using the `@SpringBootTest` annotation, you can just inject a fully configured
If you are using the `@SpringBootTest` annotation with `WebEnvironment.RANDOM_PORT` or
`TestRestTemplate` and start using it. If necessary, additional customizations can be
`WebEnvironment.DEFINED_PORT`, you can just inject a fully configured `TestRestTemplate`
applied via the `RestTemplateBuilder` bean:
and start using it. If necessary, additional customizations can be applied via the
`RestTemplateBuilder` bean:
[source,java,indent=0]
[source,java,indent=0]
----
----
...
...
spring-boot-test/src/main/java/org/springframework/boot/test/context/SpringBootTest.java
View file @
5a1741e2
...
@@ -55,7 +55,8 @@ import org.springframework.web.context.WebApplicationContext;
...
@@ -55,7 +55,8 @@ import org.springframework.web.context.WebApplicationContext;
* {@link WebEnvironment#DEFINED_PORT defined} or {@link WebEnvironment#RANDOM_PORT
* {@link WebEnvironment#DEFINED_PORT defined} or {@link WebEnvironment#RANDOM_PORT
* random} port.</li>
* random} port.</li>
* <li>Registers a {@link org.springframework.boot.test.web.client.TestRestTemplate
* <li>Registers a {@link org.springframework.boot.test.web.client.TestRestTemplate
* TestRestTemplate} bean for use in web tests.</li>
* TestRestTemplate} bean for use in web tests that are using a fully running container
* </li>
* </ul>
* </ul>
*
*
* @author Phillip Webb
* @author Phillip Webb
...
...
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