Add config for swagger
This commit is contained in:
parent
a85390ffb3
commit
8e9fd6935f
@ -1,11 +1,15 @@
|
||||
package com.cubetiqs.demo.axon
|
||||
|
||||
import com.cubetiqs.demo.axon.entity.BankAccount
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication
|
||||
import org.springframework.boot.runApplication
|
||||
import org.springframework.data.jpa.repository.JpaRepository
|
||||
import org.springframework.http.ResponseEntity
|
||||
import org.springframework.stereotype.Repository
|
||||
import org.springframework.web.bind.annotation.GetMapping
|
||||
import org.springframework.web.bind.annotation.RequestMapping
|
||||
import org.springframework.web.bind.annotation.RestController
|
||||
import java.util.UUID
|
||||
|
||||
@SpringBootApplication
|
||||
class AxonApplication
|
||||
@ -22,3 +26,6 @@ class DefaultController {
|
||||
return ResponseEntity.ok("ok")
|
||||
}
|
||||
}
|
||||
|
||||
@Repository
|
||||
interface BankAccountRepository : JpaRepository<BankAccount, UUID>
|
@ -0,0 +1,41 @@
|
||||
package com.cubetiqs.demo.axon.config
|
||||
|
||||
import org.springframework.context.annotation.Bean
|
||||
import org.springframework.context.annotation.Configuration
|
||||
import springfox.documentation.builders.PathSelectors
|
||||
import springfox.documentation.builders.RequestHandlerSelectors
|
||||
import springfox.documentation.service.ApiInfo
|
||||
import springfox.documentation.service.Contact
|
||||
import springfox.documentation.spi.DocumentationType
|
||||
import springfox.documentation.spring.web.plugins.Docket
|
||||
import springfox.documentation.swagger2.annotations.EnableSwagger2
|
||||
import java.util.Collections
|
||||
|
||||
@Configuration
|
||||
@EnableSwagger2
|
||||
class SwaggerConfiguration {
|
||||
@Bean
|
||||
fun apiDocket(): Docket {
|
||||
return Docket(DocumentationType.SWAGGER_2)
|
||||
.select()
|
||||
.apis(
|
||||
RequestHandlerSelectors
|
||||
.basePackage("com.cubetiqs.demo.axon")
|
||||
)
|
||||
.paths(PathSelectors.any())
|
||||
.build()
|
||||
.apiInfo(apiInfo)
|
||||
}
|
||||
|
||||
private val apiInfo: ApiInfo
|
||||
get() = ApiInfo(
|
||||
"Spring Boot + Axon Demo",
|
||||
"Axon Project Demo (Event Sourcing, DDD and CQRS)",
|
||||
"0.0.1-SNAPSHOT",
|
||||
"Terms of Service",
|
||||
Contact("Sambo Chea", "https://cs.cubetiqs.com", "sombochea@cubetiqs.com"),
|
||||
"MIT",
|
||||
"",
|
||||
Collections.emptyList()
|
||||
)
|
||||
}
|
Loading…
Reference in New Issue
Block a user