Updated the ignore types for swagger

This commit is contained in:
Sambo Chea 2020-08-21 12:21:39 +07:00
parent 92ba0f5729
commit 4b333ff748
2 changed files with 3 additions and 13 deletions

View File

@ -2,10 +2,6 @@ package com.cubetiqs.demo.axon
import org.springframework.boot.autoconfigure.SpringBootApplication import org.springframework.boot.autoconfigure.SpringBootApplication
import org.springframework.boot.runApplication import org.springframework.boot.runApplication
import org.springframework.http.ResponseEntity
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController
@SpringBootApplication @SpringBootApplication
class AxonApplication class AxonApplication
@ -13,12 +9,3 @@ class AxonApplication
fun main(args: Array<String>) { fun main(args: Array<String>) {
runApplication<AxonApplication>(*args) runApplication<AxonApplication>(*args)
} }
@RestController
@RequestMapping
class DefaultController {
@GetMapping
fun index(): ResponseEntity<Any> {
return ResponseEntity.ok("ok")
}
}

View File

@ -10,12 +10,14 @@ import springfox.documentation.spi.DocumentationType
import springfox.documentation.spring.web.plugins.Docket import springfox.documentation.spring.web.plugins.Docket
import springfox.documentation.swagger2.annotations.EnableSwagger2 import springfox.documentation.swagger2.annotations.EnableSwagger2
import java.util.Collections import java.util.Collections
import java.util.concurrent.CompletableFuture
@Configuration @Configuration
@EnableSwagger2 @EnableSwagger2
class SwaggerConfiguration { class SwaggerConfiguration {
@Bean @Bean
fun apiDocket(): Docket { fun apiDocket(): Docket {
val ignoreClasses = arrayListOf(CompletableFuture::class.java).toTypedArray()
return Docket(DocumentationType.SWAGGER_2) return Docket(DocumentationType.SWAGGER_2)
.select() .select()
.apis( .apis(
@ -24,6 +26,7 @@ class SwaggerConfiguration {
) )
.paths(PathSelectors.any()) .paths(PathSelectors.any())
.build() .build()
.ignoredParameterTypes(*ignoreClasses)
.apiInfo(apiInfo) .apiInfo(apiInfo)
} }