3 May 2019
Spring(8)----Spring MVC Architecture
by Jerry Zhang
#Tip of the Day: Never explode database object to frontend
Databe design
IMPORTANT! IMPORTANT! IMPORTANT!
Manage passwords with another table. Use encrypted password. Never save password directly in databases.
MVC Architecture
Never explode UserDO directly to the frontend. UserDO is the object we get from the database.
Three layer Model:
-
First Layer: Data Object. This is mapping with database without any logic.
-
Service Layer: Define a real model used for interaction.
-
View Object: Define a model to explode to frontend.
Basic concept
Controller depends on Service.
Service depends on DAO.
DAO is mapped with database.