Upgrade to Spring REST Docs 1.2.0.RC1
Closes gh-8716
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (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;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.beans.factory.support.AbstractBeanDefinition;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
|
||||
import org.springframework.context.annotation.ImportBeanDefinitionRegistrar;
|
||||
import org.springframework.core.type.AnnotationMetadata;
|
||||
import org.springframework.restdocs.ManualRestDocumentation;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* {@link ImportBeanDefinitionRegistrar} used by {@link AutoConfigureRestDocs}.
|
||||
@@ -38,12 +38,14 @@ class RestDocumentationContextProviderRegistrar implements ImportBeanDefinitionR
|
||||
BeanDefinitionRegistry registry) {
|
||||
Map<String, Object> annotationAttributes = importingClassMetadata
|
||||
.getAnnotationAttributes(AutoConfigureRestDocs.class.getName());
|
||||
BeanDefinitionBuilder definitionBuilder = BeanDefinitionBuilder
|
||||
.genericBeanDefinition(ManualRestDocumentation.class);
|
||||
String outputDir = (String) annotationAttributes.get("outputDir");
|
||||
AbstractBeanDefinition beanDefinition = BeanDefinitionBuilder
|
||||
.genericBeanDefinition(ManualRestDocumentation.class)
|
||||
.addConstructorArgValue(outputDir).getBeanDefinition();
|
||||
if (StringUtils.hasText(outputDir)) {
|
||||
definitionBuilder.addConstructorArgValue(outputDir);
|
||||
}
|
||||
registry.registerBeanDefinition(ManualRestDocumentation.class.getName(),
|
||||
beanDefinition);
|
||||
definitionBuilder.getBeanDefinition());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (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
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@WebMvcTest(controllers = RestDocsTestController.class, secure = false)
|
||||
@AutoConfigureRestDocs("target/generated-snippets")
|
||||
@AutoConfigureRestDocs
|
||||
public class RestDocsAutoConfigurationAdvancedConfigurationIntegrationTests {
|
||||
|
||||
@Before
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (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
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@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 {
|
||||
|
||||
@Before
|
||||
|
||||
Reference in New Issue
Block a user