It’s not unusual to see examples where people think they are “doing REST”, but are not. A lot of people are trying to use simple web technologies in their microservice architectures, but I suspect there’s a prevalent idea that if you are using HTTP and sending JSON back and forth, you’re doing REST, which is simply not the case. (We’re talking about the Representational State Transfer style of software architecture here, in case you’re lost.)
Spring’s REST
Spring’s Web MVC Framework documentation says in the first paragraph: “With the introduction of Spring 3.0, the @Controller
mechanism also allows you to create RESTful Web sites and applications…” Further on, introducing its @RestController
interface, it says: “It’s a very common use case to have Controllers implement a REST API, thus serving only JSON, XML or custom MediaType content.” So, does creating a web service using a @RestController
-annotated class magically make it a RESTful service?
No. Such no.
Not so REST
The big thing I see developers getting wrong when trying to use web technologies for inter-service communication is that they continue to think about operations. Continue reading