Tutorial | Spring tutorial
Sofar,you’vebuiltanevolvableAPIwithbareboneslinks.TogrowyourAPIandbetterserveyourclients,youneedtoembracetheconceptofHypermediaastheEngineofApplicationState.Whatdoesthatmean?Inthissection,you’llexploreitindetail.Businesslogicinevitablybuildsuprulesthatinvolveprocesses.Theriskofsuchsystemsisweoftencarrysuchserver-sidelogicintoclientsandbuildupstrongcoupling.RESTisaboutbreakingdownsuchconnectionsandminimizingsuchcoupling.Toshowhowtocopewithstatechangeswithouttriggeringbreakingchangesinclients,...
So far, you’ve built an evolvable API with bare bones links. To grow your API and better serve your clients, you need to embrace the concept of Hypermedia as the Engine of Application State.
What does that mean? In this section, you’ll explore it in detail.
Business logic inevitably builds up rules that involve processes. The risk of such systems is we often carry such server-side logic into clients and build up strong coupling. REST is about breaking down such connections and minimizing such coupling.
To show how to cope with state changes without triggering breaking changes in clients, imagine adding a system that fulfills orders.
As a first step, define an Order record:
links/src/main/java/payroll/Order.java
package payroll; import java.util.Objects; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persist...