Creating REST controllers
Before we create the frontend of our refactored application, we need to create controllers to expose our functionality as REST/JavaScript Object Notation (JSON) services. To accomplish this, we have created a new project called banking-rest
. This lays the foundation for refactoring to microservices.
Let's examine our account controller. We have an interface called AccountController
, as shown in the following code block:
AccountController.java
public interface AccountController { ResponseEntity<?> depositFunds(final UUID id, final DepositBean deposit, final User user); ResponseEntity<?> getAccount(final UUID id, final User user); ResponseEntity<?> getAccounts(final User user); ResponseEntity<?> getBalance(final UUID id, final User user); ResponseEntity<?> getDeposit...