Swagger not detecting Api built with Spring Data Rest

后端 未结 5 1926
我在风中等你
我在风中等你 2021-01-19 18:10

I\'m working on a spring boot application using swagger to generate docs for my API ,I\'m using Spring data rest to generate the Api but when I run the app I get the swagger

5条回答
  •  梦谈多话
    2021-01-19 18:37

    This did the trick for me, upgrading to the latest snapshot of springfox

    
    ...
    
        io.springfox
        springfox-swagger2
        3.0.0-SNAPSHOT
    
    
        io.springfox
        springfox-swagger-ui
        3.0.0-SNAPSHOT
    
    
        io.springfox
        springfox-data-rest
        3.0.0-SNAPSHOT
    
    ...
    
    
    
        
            JFrog
            JFrog Snapshot Repository
            http://oss.jfrog.org/artifactory/oss-snapshot-local/
        
    
    

    Then use @EnableSwagger2WebMvc instead of @EnableSwagger2:

    @SpringBootApplication
    @EnableSwagger2WebMvc
    @Import(SpringDataRestConfiguration.class)
    public class MyApplication {
    
        public static void main(String[] args) {
            SpringApplication.run(MyApplication.class, args);
        }
    
    }
    

    All thanks to Yann39.

提交回复
热议问题