Merge pull request #10765 from Maiklins/JAVA-2399-Update_spring-security-rest_module_to_use_Swagger_3.0.0

Java 2399 update spring security rest module to use swagger 3.0.0
This commit is contained in:
kwoyke 2021-05-25 11:02:37 +02:00 committed by GitHub
commit c24379b927
2 changed files with 9 additions and 11 deletions

View File

@ -249,7 +249,7 @@
<!-- testing --> <!-- testing -->
<rest-assured.version>2.9.0</rest-assured.version> <rest-assured.version>2.9.0</rest-assured.version>
<!-- swagger --> <!-- swagger -->
<springfox-swagger.version>2.9.2</springfox-swagger.version> <springfox-swagger.version>3.0.0</springfox-swagger.version>
<!-- Maven plugins --> <!-- Maven plugins -->
<cargo-maven2-plugin.version>1.6.1</cargo-maven2-plugin.version> <cargo-maven2-plugin.version>1.6.1</cargo-maven2-plugin.version>
</properties> </properties>

View File

@ -6,12 +6,11 @@ import java.util.Collections;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.http.HttpMethod;
import springfox.documentation.builders.PathSelectors; import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors; import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.builders.ResponseMessageBuilder; import springfox.documentation.builders.ResponseBuilder;
import springfox.documentation.schema.ModelRef;
import springfox.documentation.service.ApiInfo; import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact; import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType; import springfox.documentation.spi.DocumentationType;
@ -30,13 +29,12 @@ public class SwaggerConfig {
.build() .build()
.apiInfo(apiInfo()) .apiInfo(apiInfo())
.useDefaultResponseMessages(false) .useDefaultResponseMessages(false)
.globalResponseMessage(RequestMethod.GET, newArrayList(new ResponseMessageBuilder().code(500) .globalResponses(HttpMethod.GET, newArrayList(
.message("500 message") new ResponseBuilder().code("500")
.responseModel(new ModelRef("Error")) .description("500 message").build(),
.build(), new ResponseBuilder().code("403")
new ResponseMessageBuilder().code(403) .description("Forbidden!!!!!").build()
.message("Forbidden!!!!!") ));
.build()));
} }
private ApiInfo apiInfo() { private ApiInfo apiInfo() {