@Bean Public Docket Customimplementation () { return new docket (documentationtype.swagger_2) . Select () . APIs (requesthandlerselectors.basepackage ("Com.xx.controller")) . Build () . Directmodelsubstitute (Org.joda.time.LocalDate.class, Java.sql.Date.class) . Directmodelsubstitute ( Org.joda.time.DateTime.class, Java.util.Date.class) . Apiinfo (Apiinfo ()); }
As shown, using the basepackage scan Com.xx.controller, after starting the project to access http://127.0.0.1:8088/swagger-ui.html, the page can be out of the interface document does not come out. Then replace the following:
@Bean Public Docket API () { return new docket (documentationtype.swagger_2) . Apiinfo (Apiinfo ()) . Select () . APIs (requesthandlerselectors.withmethodannotation (apioperation.class)) . Build (); }
Change the condition of the Basepackage scan to Requesthandlerselectors.withmethodannotation (Apioperation.class), Scan the Apioperation annotated modified controller to restart the project, the interface document is displayed properly.
Spring Boot Configuration Swagger2 No document solution