Develop the Mock Service

Develop a mock service for saving data in-memory.

add function

Now that the data transfer object is set up, let’s add some functionality. The in-memory database follows the Singleton pattern implemented with an enum. A list of BookDto is saved in memory where the add method inserts a new entry to the list. The identifier field starts with one and increments by one for every new entry.

Get hands-on with 1200+ tech skills courses.