简体   繁体   中英

How to change default Swagger 2 api doc name in Java Spring API

So right now the default is: /v2/api-doc .

How can I configure swagger to be /v2/swagger.json

I don't know how to find the property file.

Solution is on the comments in .yml file :

springfox:
  documentation:
    swagger:
      v2:
       path: /v1/swagger.json

If you are using Springfox :

You can point users that want to generate code based on your swagger spec to /v2/api-docs. When you don't like what you're seeing, don't worry, this can be changed too. Add the property springfox.documentation.swagger.v2.path to the application.properties file of your application and set its value to any path you'd like the docs to be available on.

/v2/api-doc is default url.

To add your custom url add following in propertyfile

springfox.documentation.swagger.v2.path=/my/path

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM