Swagger2 Oauth2.0 令牌 请求头
@EnableSwagger2
@Bean public Docket createRestApi() { ParameterBuilder tokenPar = new ParameterBuilder(); List<Parameter> pars = new ArrayList<>(); tokenPar.name("Authorization").description("令牌").modelRef(new ModelRef("string")).parameterType("header").required(true).build(); pars.add(tokenPar.build()); return new Docket(DocumentationType.SWAGGER_2) .host(host) .apiInfo(apiInfo()) .select() .apis(RequestHandlerSelectors.basePackage("com.lzw.controller.api")) .paths(PathSelectors.any()) .build() .globalOperationParameters(pars); }