- Compile with Gradle before running.
- Run the main method in the DemoApplication.java file
- Use Postman for http requests by test.postman_collection.json
http request URLs:
1)POST http://127.0.0.1:8080/api/add
2)POST http://127.0.0.1:8080/api/spend
3)GET http://127.0.0.1:8080/api/balance
Description:
- Use CopyOnWriteArrayList as a local cache
- Override the equals method in the TransactionRoute file to prevent adding a new Transaction Route record failing
- Maintain the id of the last Transaction Route record with AtomicInteger
- Balance is returned in the order in which Transaction Route was added
- URL /api/spend is returned in the order in which Transaction Route was added