dimanche 12 juillet 2020

How to use a design pattern to arrange the file structure in a java+spring application

I created a web application which gets the data from the user from the console and stores the data in MongoDB and pass the data to the Angular frontend using Spring rest api.
Whole system is working finely and now I want to rearrange the folder structure according to a design pattern and as shown below I tried to use MVC model but I'm not sure if the file rearrangement is correct I don't know much about design patterns. So please help me with this matter and if the below structure is wrong please help me to make it correct.

enter image description here

Controlller

BookController - Class with rest api to pass data to angular frontend (REST Controller class)

Model

Book - Parent class with variables and relevant methods
Novel - Child class with variables and relevant methods
Poems - Child class with variables and relevant methods
MyBookManager - BookManager interface implemented class which includes crud operations with mongoDB

View

BookManager - Interface related to MyBookManager
Console - Class which takes the input from users from the the console and calls methods in MyBookManager to save them to DB

Repository

BookRepository - Interface which extends MongoRepository

Remainingclasses

BookStoreApplication - Class which includes the main method(Running class)
ErrorHandle - Class which includes methods for validations

Aucun commentaire:

Enregistrer un commentaire