How winterchens/my-site works
Main Components
• Client Side (Browser/User Interface)
– Two entry-points: the public website and the administration backend.
– Serve static assets (HTML, CSS, JavaScript) from both the “file/avana” folder (for certain front-end pages) and the “src/main/resources/static” directories (for admin, error, site).
• Web Server / Application Layer
– The Spring Boot application (MySiteApplication.java) acting as the central controller.
– Controllers: Organized into public (HomeController) and administration (admin controllers) to handle user interactions.
– Service Layer: Business logic is split across services (e.g., ContentService, CommentService, UserService, etc.).
– Data Access Layer: DAOs and MyBatis mappers (in “src/main/resources/mapper”) for persistence operations.
– Utilities, interceptors, aspects (like WebLogAspect) are used for cross-cutting concerns such as logging, exception handling, and security.
• Data Storage
– A SQL database as indicated by the “lu_tale.sql” file, which holds the site data (articles, comments, user info, etc.).
– Caching (e.g., EhCache as mentioned in the README history).
• External Services
– A cloud storage/component (e.g., QiniuCloudService) for handling file uploads or images.
– Docker environment and associated tools (Dockerfile, docker-compose.yml, docker-build.sh) for containerization and deployment.
• Client Browser:
– Two types: Public users and Admin users.
• Web Server / Application Container:
– Represent the Spring Boot container and mark it as running within Docker.
– Within this container, show layers: Controller layer → Service layer → DAO layer → Database.
– Include a separate “view/rendering” indicator showing Thymeleaf templates that process and deliver the final HTML pages.
▫ Controllers depend on the Service layer.
▫ Services call the DAO layer and external APIs (like Qiniu Cloud).
▫ Interceptors and Aspects wrap around controllers for logging and error handling.
• Database Layer:
– Show an RDBMS component that stores the persistent data.
• External Service(s):
– Represent external dependencies like Qiniu Cloud for file storage.
– Optionally, represent logging or monitoring systems if applicable.
Architectural Patterns and Design Principles
• MVC Pattern: Clearly indicate separation between Model (data and domain objects), View (Thymeleaf templates, static resources), and Controller layers.
• Layered Architecture: Separate controllers, service, DAO, and utility components.
• Containerization: Note the Docker container environment which encapsulates the entire Spring Boot app.
• Modular Separation: There is clear division between front-end (static assets in “file/avana” and “src/main/resources/static”) and back-end (core Java code in “src/main/java/cn/luischen”).
Technologies and Frameworks to Highlight
• Spring Boot 2.0, Spring MVC
• MyBatis as the ORM (with XML mappers under “src/main/resources/mapper”)
• Thymeleaf for view rendering
• Docker for container management
• (Optional) Swagger for API documentation (Swagger2.java file present)