java.lang.Object
springfox.documentation.spring.web.plugins.Docket
所有已实现的接口:
org.springframework.plugin.core.Plugin<DocumentationType>, DocumentationPlugin

public class Docket extends Object implements DocumentationPlugin
A builder which is intended to be the primary interface into the Springfox framework. Provides sensible defaults and convenience methods for configuration.
  • 字段详细资料

  • 构造器详细资料

  • 方法详细资料

    • extensions

      public Docket extensions(List<VendorExtension> vendorExtensions)
      Add to the api's vendor extensions
      参数:
      vendorExtensions - Indicates the vendor extension information
      返回:
      this Docket
    • apiInfo

      public Docket apiInfo(ApiInfo apiInfo)
      Sets the api's meta information as included in the json ResourceListing response.
      参数:
      apiInfo - Indicates the api information
      返回:
      this Docket
    • securitySchemes

      public Docket securitySchemes(List<? extends SecurityScheme> securitySchemes)
      Configures the global io.swagger.model.SecurityScheme's applicable to all or some of the api operations. The configuration of which operations have associated SecuritySchemes is configured with springfox.swagger.plugins.Docket#securityContexts
      参数:
      securitySchemes - a list of security schemes
      返回:
      this Docket
    • securityContexts

      public Docket securityContexts(List<SecurityContext> securityContexts)
      Configures which api operations (via regex patterns) and HTTP methods to apply security contexts to apis.
      参数:
      securityContexts - - defines security requirements for the apis
      返回:
      this Docket
    • groupName

      public Docket groupName(String groupName)
      If more than one instance of Docket exists, each one must have a unique groupName as supplied by this method. Defaults to "default".
      参数:
      groupName - - the unique identifier of this swagger group/configuration
      返回:
      this Docket
    • pathProvider

      public Docket pathProvider(springfox.documentation.PathProvider pathProvider)
      Determines the generated, swagger specific, urls. By default, relative urls are generated. If absolute urls are required, supply an implementation of AbsoluteSwaggerPathProvider
      参数:
      pathProvider - - provides an alternate implementation of path provider
      返回:
      this Docket
      另请参阅:
    • globalResponseMessage

      public Docket globalResponseMessage(org.springframework.web.bind.annotation.RequestMethod requestMethod, List<ResponseMessage> responseMessages)
      Overrides the default http response messages at the http request method level. To set specific response messages for specific api operations use the swagger core annotations on the appropriate controller methods.
      参数:
      requestMethod - - http request method for which to apply the message
      responseMessages - - the message
      返回:
      this Docket and
      另请参阅:
    • globalOperationParameters

      public Docket globalOperationParameters(List<Parameter> operationParameters)
      Adds default parameters which will be applied to all operations.
      参数:
      operationParameters - parameters which will be globally applied to all operations
      返回:
      this Docket
    • ignoredParameterTypes

      public Docket ignoredParameterTypes(Class... classes)
      Adds ignored controller method parameter types so that the framework does not generate swagger model or parameter information for these specific types. e.g. HttpServletRequest/HttpServletResponse which are already included in the pre-configured ignored types.
      参数:
      classes - the classes to ignore
      返回:
      this Docket
      另请参阅:
    • produces

      public Docket produces(Set<String> produces)
    • consumes

      public Docket consumes(Set<String> consumes)
    • host

      public Docket host(String host)
    • protocols

      public Docket protocols(Set<String> protocols)
    • alternateTypeRules

      public Docket alternateTypeRules(AlternateTypeRule... alternateTypeRules)
      Adds model substitution rules (alternateTypeRules)
      参数:
      alternateTypeRules - - rules to be applied
      返回:
      this Docket
      另请参阅:
    • operationOrdering

      public Docket operationOrdering(com.google.common.collect.Ordering<Operation> operationOrdering)
      Provide an ordering schema for operations NOTE: @see #732 in case you're wondering why specifying position might not work.
      参数:
      operationOrdering - - ordering of the operations
      返回:
      this Docket
    • directModelSubstitute

      public Docket directModelSubstitute(Class clazz, Class with)
      Directly substitutes a model class with the supplied substitute e.g directModelSubstitute(LocalDate.class, Date.class) would substitute LocalDate with Date
      参数:
      clazz - class to substitute
      with - the class which substitutes 'clazz'
      返回:
      this Docket
    • genericModelSubstitutes

      public Docket genericModelSubstitutes(Class... genericClasses)
      Substitutes each generic class with it's direct parameterized type. Use this method to only for types with a single parameterized type. e.g. List<T> or ResponseEntity<T> .genericModelSubstitutes(ResponseEntity.class) would substitute ResponseEntity <MyModel> with MyModel
      参数:
      genericClasses - - generic classes on which to apply generic model substitution.
      返回:
      this Docket
    • useDefaultResponseMessages

      public Docket useDefaultResponseMessages(boolean apply)
      Allows ignoring predefined response message defaults
      参数:
      apply - flag to determine if the default response messages are used true - the default response messages are added to the global response messages false - the default response messages are not added to the global response messages
      返回:
      this Docket
    • apiListingReferenceOrdering

      public Docket apiListingReferenceOrdering(com.google.common.collect.Ordering<ApiListingReference> apiListingReferenceOrdering)
      Controls how ApiListingReference's are sorted. i.e the ordering of the api's within the swagger Resource Listing. The default sort is Lexicographically by the ApiListingReference's path NOTE: @see #732 in case you're wondering why specifying position might not work.
      参数:
      apiListingReferenceOrdering - - ordering of the api listing references
      返回:
      this Docket
    • apiDescriptionOrdering

      public Docket apiDescriptionOrdering(com.google.common.collect.Ordering<ApiDescription> apiDescriptionOrdering)
      Controls how io.swagger.model.ApiDescription's are ordered. The default sort is Lexicographically by the ApiDescription's path. NOTE: @see #732 in case you're wondering why specifying position might not work.
      参数:
      apiDescriptionOrdering - - ordering of the api descriptions
      返回:
      this Docket
      另请参阅:
    • enable

      public Docket enable(boolean externallyConfiguredFlag)
      Hook to externally control auto initialization of this swagger plugin instance. Typically used if defer initialization.
      参数:
      externallyConfiguredFlag - - true to turn it on, false to turn it off
      返回:
      this Docket
    • forCodeGeneration

      public Docket forCodeGeneration(boolean forCodeGen)
      Set this to true in order to make the documentation code generation friendly
      参数:
      forCodeGen - - true|false determines the naming strategy used
      返回:
      this Docket
    • pathMapping

      public Docket pathMapping(String path)
      Extensibility mechanism to add a servlet path mapping, if there is one, to the apis base path.
      参数:
      path - - path that acts as a prefix to the api base path
      返回:
      this Docket
    • enableUrlTemplating

      public Docket enableUrlTemplating(boolean enabled)
      Decides whether to use url templating for paths. This is especially useful when you have search api's that might have multiple request mappings for each search use case. This is an incubating feature that may not continue to be supported after the swagger specification is modified to accommodate the use case as described in issue #711
      参数:
      enabled - - when true it enables rfc6570 url templates
      返回:
      this Docket
    • additionalModels

      public Docket additionalModels(com.fasterxml.classmate.ResolvedType first, com.fasterxml.classmate.ResolvedType... remaining)
      Method to add additional models that are not part of any annotation or are perhaps implicit
      参数:
      first - - at least one is required
      remaining - - possible collection of more
      返回:
      on-going docket
      从以下版本开始:
      2.4.0
    • tags

      public Docket tags(Tag first, Tag... remaining)
      Method to add global tags to the docket
      参数:
      first - - at least one tag is required to use this method
      remaining - - remaining tags
      返回:
      this Docket
    • select

      public ApiSelectorBuilder select()
      Initiates a builder for api selection.
      返回:
      api selection builder. To complete building the api selector, the build method of the api selector needs to be called, this will automatically fall back to building the docket when the build method is called.
    • configure

      Builds the Docket by merging/overlaying user specified values. It is not necessary to call this method when defined as a spring bean. NOTE: Calling this method more than once has no effect.
      指定者:
      configure 在接口中 DocumentationPlugin
      另请参阅:
    • getGroupName

      public String getGroupName()
      指定者:
      getGroupName 在接口中 DocumentationPlugin
    • isEnabled

      public boolean isEnabled()
      指定者:
      isEnabled 在接口中 DocumentationPlugin
    • getDocumentationType

      public DocumentationType getDocumentationType()
      指定者:
      getDocumentationType 在接口中 DocumentationPlugin
    • supports

      public boolean supports(DocumentationType delimiter)
      指定者:
      supports 在接口中 org.springframework.plugin.core.Plugin<DocumentationType>