Jerry's Blog

Recording what I learned everyday

View on GitHub


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:

  1. First Layer: Data Object. This is mapping with database without any logic.

  2. Service Layer: Define a real model used for interaction.

  3. View Object: Define a model to explode to frontend.

Basic concept

Controller depends on Service.

Service depends on DAO.

DAO is mapped with database.

Directory Structure

mvc

tags: Java, - Spring, - Spring - MVC