How to Add a new version of java rest API - Springboot -
how shall add new version of controller class in rest api? here scenario.
my current rest api version set in application.properties below
server.contextpath=/my_rest_api/v1
we using springfox swagger ui. swagger api docs path mentioned in same application.properties below
springfox.documentation.swagger.v2.path=/api-docs
few controllers created , mapped example @requestmapping("/address")
i able access address controller using url /my_rest_api/v1/address
, api-docs accessible under url '/my_rest_api/v1/api-docs'.
have few modifications required in existing address controller. backward compatibility need keep current version also. plan create version 2 of rest api. best approach this.
i thinking create new version of address controller @requestmapping("/v2/address")
, change current address controller @requestmapping("/v1/address")
, remove version server context server.contextpath=/my_rest_api/
. right approach?? if no please advice. if way ok. how shall set springfox.documentation.swagger.v2.path=/api-docs
each version?. new this.. appreciated.
Comments
Post a Comment