Swagger not detecting Spring Data Rest APIs with Spring Boot -


i setup spring boot project including spring data rest , swagger:

<dependency>         <groupid>org.springframework.boot</groupid>         <artifactid>spring-boot-starter-data-rest</artifactid> </dependency> <dependency>         <groupid>io.springfox</groupid>         <artifactid>springfox-swagger2</artifactid>         <version>2.4.0</version> </dependency> <dependency>         <groupid>io.springfox</groupid>         <artifactid>springfox-swagger-ui</artifactid>         <version>2.4.0</version> </dependency> 

this swagger configuration:

@configuration @enableswagger2 public class swaggerconfig {     @bean     public docket api() {         return new docket(documentationtype.swagger_2)                 .select()                 .apis(requesthandlerselectors.any())                 .paths(pathselectors.any())                 .build();     } } 

excerpt application.properties:

spring.data.rest.base-path=/api server.context-path=/myapp 

when run server, rest endpoints correctly mapped , reachable /myapp/api/..., including custom restcontroller created on own.

however:

  • at http://localhost:8080/myapp/api can see list of spring data rest apis (in json format) cannot see custom restcontroller endpoints.

  • at http://localhost:8080/myapp/swagger-ui.html see nice gui lists custom restcontroller , error endpoint, not spring data rest apis. in fact, http://localhost:8080/myapp/v2/api-docs not make reference spring data rest endpoints, custom restcontroller , error endpoint.

how can fix spring data rest & swagger configuration?

spring data rest support introduced in springfox version 2.6.0. if follow the instructions after upgrading latest version of springfox (2.6.1 @ time of writing) shouldn't have problem rendering endpoints.


Comments

Popular posts from this blog

python - How to insert QWidgets in the middle of a Layout? -

python - serve multiple gunicorn django instances under nginx ubuntu -

module - Prestashop displayPaymentReturn hook url -