Learn Api Versioning in Spring Rest

Go Back to Course Outline Repositories

Go Back to Course Outline

There are several ways in which we can version our application. Some of them are:
  • By URL
  • By params
  • By headers
  • By produces or Accept header
There’s really no standard way to do it. In fact, there’s an argument on which is better between by URL or by params. Personally, I use the URL approach as it’s useful when bookmarking.

In my previous company, we keep backward compatibility of the API to 3 major releases and that spell disaster without the proper planning and migration of data and models. In our example, we have a complete name save as a string, but in version 2 we created a Name model that contains firstName and lastName.

To demonstrate some examples.

[open DealerVersionController class]

Now let’s start testing them. Open the file:
src/test/resources/TerawarehouseCatalog.postman_collection in Postman and play with the tests inside the versioning folder.


spring-rest 8485165679290576857

Post a Comment Default Comments


Are you looking for freelancers in the Philippines? Get in touch.


If you like what I do, you can support this channel by buying me a coffee. I would be grateful for your contribution! Your donations will help me create more FREE online courses and learning materials for programmers and remote workers.