The main reason is that the controller is not scanned in the swagger configuration, Here is the solution below:
public Docket createRestApi(){
return new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo())
.select()
.apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
.build();
}
apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
Indicates that swagger will scan the interface with @API.
Done!