Is there a way I can stop springfox swagger from scanning the model classes?

后端 未结 3 1012
小鲜肉
小鲜肉 2021-01-05 08:38

I\'m currently using Springfox Swagger to document my spring boot application with a Java config. My API starts in about 75 seconds, (it was originally 20 secs without Sprin

3条回答
  •  自闭症患者
    2021-01-05 09:29

    Springfox Swagger2 acquire UI data through GET /v2/api-docs, which will mapping to springfox.documentation.swagger2.web.Swagger2Controller.getDocumentation().So you can just create a bean to take place of 'ServiceModelToSwagger2Mapper' with your sanning logic:

    @Primary
    @Component
    class CustomServiceModelToSwagger2Mapper : ServiceModelToSwagger2MapperImpl() {
          override fun mapDocumentation(from: Documentation?): Swagger? {
    
                   // scanning logics...
          }
    }
    

    refer to my another related answer : https://stackoverflow.com/a/64057512/14332259

提交回复
热议问题