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 message : No operations defined in spec!
This my Api code :
@Api(tags = "projets")
@RepositoryRestResource(collectionResourceRel = "projets", path = "projets")
public interface IProjectRepository extends JpaRepository<Project, Long> {
}
And this my configuration file :
@Configuration
@EnableSwagger2
public class QfactoryConfiguration {
@Bean
public Docket getDocketInstance() {
return new Docket(DocumentationType.SWAGGER_2)
.apiInfo(new ApiInfoBuilder()
.title("Spring Boot project")
.description("Spring Boot bootstrap project")
.version("0.1")
.license("Unlicense")
.build())
.select()
.apis(RequestHandlerSelectors.basePackage("com.errabi.qfactory.repositories"))
.paths(PathSelectors.any())
.build();
}
}
And this the dependencies that I'm using :
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.9.2</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-data-rest</artifactId>
<version>2.9.2</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.9.2</version>
</dependency>
I'm asking is the Swagger is able to generate docs for Api generated by Spring data rest or I should use a @RestController with annotations @Api,@ApiOperation
I'm using spring boot version : 2.1.3.RELEASE