Creating DAOs in Spring Boot without using Database
-
Step One : Create Package to make your work standard

Just right click on com.demo.demo then click new -> package
Step Two: Create Entity or Object
Into Entity package right click -> new -> Java Class
Note: You will define your attribute based on need as shown bellow,you can also provide get and set methodStep Three: Create Interface
Interface, is abstracts the operations on data without knowing the details of the underlying data source.
Here we will have two method save() and findAll().

Step Four: Create Implementation of Interface
private List<User> users = new ArrayList<>();
This line ensures that when the UserImplement class is instantiated, the users variable will be a new, empty ArrayList that can be used to store User objects. This ArrayList will dynamically grow as User objects are added to it.
Step Five: create Service Class for logic implementation

Step Six: Create Controller for end-point implementation

Step Seven: Here is how Function main look like

Testing Our Program I will use postman
-
Creating User

-
Get Users

-
-
Great post
-
Thanks for sharing!