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
2fd51dd8
Commit
2fd51dd8
authored
Mar 24, 2017
by
Andy Wilkinson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upgrade to Spring REST Docs 1.2.0.RC1
Closes gh-8716
parent
5e0acc60
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
19 additions
and
16 deletions
+19
-16
pom.xml
spring-boot-dependencies/pom.xml
+1
-1
spring-boot-features.adoc
spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc
+6
-5
RestDocumentationContextProviderRegistrar.java
...e/restdocs/RestDocumentationContextProviderRegistrar.java
+8
-6
RestDocsAutoConfigurationAdvancedConfigurationIntegrationTests.java
...toConfigurationAdvancedConfigurationIntegrationTests.java
+2
-2
RestDocsAutoConfigurationIntegrationTests.java
...e/restdocs/RestDocsAutoConfigurationIntegrationTests.java
+2
-2
No files found.
spring-boot-dependencies/pom.xml
View file @
2fd51dd8
...
@@ -167,7 +167,7 @@
...
@@ -167,7 +167,7 @@
<spring-loaded.version>
1.2.7.RELEASE
</spring-loaded.version>
<spring-loaded.version>
1.2.7.RELEASE
</spring-loaded.version>
<spring-mobile.version>
2.0.0.M1
</spring-mobile.version>
<spring-mobile.version>
2.0.0.M1
</spring-mobile.version>
<spring-plugin.version>
1.2.0.RELEASE
</spring-plugin.version>
<spring-plugin.version>
1.2.0.RELEASE
</spring-plugin.version>
<spring-restdocs.version>
1.2.0.
BUILD-SNAPSHOT
</spring-restdocs.version>
<spring-restdocs.version>
1.2.0.
RC1
</spring-restdocs.version>
<spring-retry.version>
1.2.0.RELEASE
</spring-retry.version>
<spring-retry.version>
1.2.0.RELEASE
</spring-retry.version>
<spring-security.version>
5.0.0.BUILD-SNAPSHOT
</spring-security.version>
<spring-security.version>
5.0.0.BUILD-SNAPSHOT
</spring-security.version>
<spring-security-jwt.version>
1.0.7.RELEASE
</spring-security-jwt.version>
<spring-security-jwt.version>
1.0.7.RELEASE
</spring-security-jwt.version>
...
...
spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc
View file @
2fd51dd8
...
@@ -5770,7 +5770,7 @@ remove the need for Spring REST Docs' JUnit rule.
...
@@ -5770,7 +5770,7 @@ remove the need for Spring REST Docs' JUnit rule.
@RunWith(SpringRunner.class)
@RunWith(SpringRunner.class)
@WebMvcTest(UserController.class)
@WebMvcTest(UserController.class)
@AutoConfigureRestDocs
("target/generated-snippets")
@AutoConfigureRestDocs
public class UserDocumentationTests {
public class UserDocumentationTests {
@Autowired
@Autowired
...
@@ -5786,10 +5786,11 @@ remove the need for Spring REST Docs' JUnit rule.
...
@@ -5786,10 +5786,11 @@ remove the need for Spring REST Docs' JUnit rule.
}
}
----
----
In addition to configuring the output directory, `@AutoConfigureRestDocs` can also
`@AutoConfigureRestDocs` can be used to override the default output directory
configure the host, scheme, and port that will appear in any documented URIs. If you
(`target/generated-snippets` if you are using Maven or `build/generated-snippets` if you
require more control over Spring REST Docs' configuration a
are using Gradle). It can also be used to configure the host, scheme, and port that will
`RestDocsMockMvcConfigurationCustomizer` bean can be used:
appear in any documented URIs. If you require more control over Spring REST Docs'
configuration a `RestDocsMockMvcConfigurationCustomizer` bean can be used:
[source,java,indent=0]
[source,java,indent=0]
----
----
...
...
spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/restdocs/RestDocumentationContextProviderRegistrar.java
View file @
2fd51dd8
/*
/*
* Copyright 2012-201
6
the original author or authors.
* Copyright 2012-201
7
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -18,12 +18,12 @@ package org.springframework.boot.test.autoconfigure.restdocs;
...
@@ -18,12 +18,12 @@ package org.springframework.boot.test.autoconfigure.restdocs;
import
java.util.Map
;
import
java.util.Map
;
import
org.springframework.beans.factory.support.AbstractBeanDefinition
;
import
org.springframework.beans.factory.support.BeanDefinitionBuilder
;
import
org.springframework.beans.factory.support.BeanDefinitionBuilder
;
import
org.springframework.beans.factory.support.BeanDefinitionRegistry
;
import
org.springframework.beans.factory.support.BeanDefinitionRegistry
;
import
org.springframework.context.annotation.ImportBeanDefinitionRegistrar
;
import
org.springframework.context.annotation.ImportBeanDefinitionRegistrar
;
import
org.springframework.core.type.AnnotationMetadata
;
import
org.springframework.core.type.AnnotationMetadata
;
import
org.springframework.restdocs.ManualRestDocumentation
;
import
org.springframework.restdocs.ManualRestDocumentation
;
import
org.springframework.util.StringUtils
;
/**
/**
* {@link ImportBeanDefinitionRegistrar} used by {@link AutoConfigureRestDocs}.
* {@link ImportBeanDefinitionRegistrar} used by {@link AutoConfigureRestDocs}.
...
@@ -38,12 +38,14 @@ class RestDocumentationContextProviderRegistrar implements ImportBeanDefinitionR
...
@@ -38,12 +38,14 @@ class RestDocumentationContextProviderRegistrar implements ImportBeanDefinitionR
BeanDefinitionRegistry
registry
)
{
BeanDefinitionRegistry
registry
)
{
Map
<
String
,
Object
>
annotationAttributes
=
importingClassMetadata
Map
<
String
,
Object
>
annotationAttributes
=
importingClassMetadata
.
getAnnotationAttributes
(
AutoConfigureRestDocs
.
class
.
getName
());
.
getAnnotationAttributes
(
AutoConfigureRestDocs
.
class
.
getName
());
BeanDefinitionBuilder
definitionBuilder
=
BeanDefinitionBuilder
.
genericBeanDefinition
(
ManualRestDocumentation
.
class
);
String
outputDir
=
(
String
)
annotationAttributes
.
get
(
"outputDir"
);
String
outputDir
=
(
String
)
annotationAttributes
.
get
(
"outputDir"
);
AbstractBeanDefinition
beanDefinition
=
BeanDefinitionBuilder
if
(
StringUtils
.
hasText
(
outputDir
))
{
.
genericBeanDefinition
(
ManualRestDocumentation
.
class
)
definitionBuilder
.
addConstructorArgValue
(
outputDir
);
.
addConstructorArgValue
(
outputDir
).
getBeanDefinition
();
}
registry
.
registerBeanDefinition
(
ManualRestDocumentation
.
class
.
getName
(),
registry
.
registerBeanDefinition
(
ManualRestDocumentation
.
class
.
getName
(),
beanDefinition
);
definitionBuilder
.
getBeanDefinition
()
);
}
}
}
}
spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/restdocs/RestDocsAutoConfigurationAdvancedConfigurationIntegrationTests.java
View file @
2fd51dd8
/*
/*
* Copyright 2012-201
6
the original author or authors.
* Copyright 2012-201
7
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -47,7 +47,7 @@ import static org.springframework.test.web.servlet.request.MockMvcRequestBuilder
...
@@ -47,7 +47,7 @@ import static org.springframework.test.web.servlet.request.MockMvcRequestBuilder
*/
*/
@RunWith
(
SpringRunner
.
class
)
@RunWith
(
SpringRunner
.
class
)
@WebMvcTest
(
controllers
=
RestDocsTestController
.
class
,
secure
=
false
)
@WebMvcTest
(
controllers
=
RestDocsTestController
.
class
,
secure
=
false
)
@AutoConfigureRestDocs
(
"target/generated-snippets"
)
@AutoConfigureRestDocs
public
class
RestDocsAutoConfigurationAdvancedConfigurationIntegrationTests
{
public
class
RestDocsAutoConfigurationAdvancedConfigurationIntegrationTests
{
@Before
@Before
...
...
spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/restdocs/RestDocsAutoConfigurationIntegrationTests.java
View file @
2fd51dd8
/*
/*
* Copyright 2012-201
6
the original author or authors.
* Copyright 2012-201
7
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -40,7 +40,7 @@ import static org.springframework.test.web.servlet.request.MockMvcRequestBuilder
...
@@ -40,7 +40,7 @@ import static org.springframework.test.web.servlet.request.MockMvcRequestBuilder
*/
*/
@RunWith
(
SpringRunner
.
class
)
@RunWith
(
SpringRunner
.
class
)
@WebMvcTest
@WebMvcTest
@AutoConfigureRestDocs
(
outputDir
=
"target/generated-snippets"
,
uriScheme
=
"https"
,
uriHost
=
"api.example.com"
,
uriPort
=
443
)
@AutoConfigureRestDocs
(
uriScheme
=
"https"
,
uriHost
=
"api.example.com"
,
uriPort
=
443
)
public
class
RestDocsAutoConfigurationIntegrationTests
{
public
class
RestDocsAutoConfigurationIntegrationTests
{
@Before
@Before
...
...
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