@Configuration
@EnableSwagger2
public class SwaggerConfig {
// 设置默认TOKEN,方便测试
private static final String TOKEN = “Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJhZG1pbi1bXSIsImlhdCI6MTY1MDE1OTY5MiwiZXhwIjoxNjUwMTg5NjkyfQ.SqJw_zheT9A8sWsqL3sSGRMuNkY_Oi-SJh1ztqq-zx61Vv0t66WsxZOGspLt2CqIzaKXzq-jmnpjkpsy_44S4w”;
@Bean
public Docket api() {
ParameterBuilder tokenPar = new ParameterBuilder();
List pars = new ArrayList();
tokenPar.name(“Authorization”).description(“令牌”).defaultValue(TOKEN).modelRef(new ModelRef(“string”)).paramet服务器托管网erType(“header”).required(false).build();
pars.add(tokenPar.build());
Docket docket = new Docket(DocumentationType.SWAGGER_2)
.select()
.apis(RequestHandlerSelectors.basePackage(“com.zdc.controller”))
.paths(PathSelectors.any())
.build()
.globalOperationParameters(pars)
.apiInfo(apiInfo())
.useDefaultResponseMessages(false)
.globalResponseMessage(RequestMethod.GET, newArrayList(new ResponseMessageBuil服务器托管网der().code(500).message(“500 queue”).responseModel(new ModelRef(“Error”)).build(), new ResponseMessageBuilder().code(403).message(“Forbidden!!!!!”).build()));
return docket;
}
private ApiInfo apiInfo() {
return new ApiInfoBuilder()
.title(“api”)
.description(“”)
.version(“1.0”)
.build();
}
}
服务器托管,北京服务器托管,服务器租用 http://www.fwqtg.net
选择题 1. B2. B3. C4. D5. A6. B7. C8. B9. D10. B11. A12. B 填空题 1. a b c 2.string s: I like it. String t:A like it. 3. 30 10 30 n Le服务…