How nguyendaithanh2805/coffee-shop-website works
Main Components
• Presentation Layer: This consists of the controllers (HomeController, ProductController, CartController, etc.) found in the "controller" package and the front-end resources (the static assets under “src/main/resources/static” and the HTML templates under “src/main/resources/templates” for both admin and user). These components handle incoming HTTP requests and serve the user interface.
• Business Logic Layer: The "service" package contains service interfaces and their implementations (e.g., ProductServiceImpl, OrderServiceImpl, etc.) that encompass the business logic.
• Data Access Layer: The "repository" package is split into standard JPA repository interfaces and their "Jdbc" counterparts (for Admin, Article, Cart, etc.). These components are responsible for interacting with the database.
• Domain/Model Layer: The "model" package captures the domain entities (Product, Order, Customer, etc.).
• Configuration & Security: The "config" package contains security configuration (SecurityConfig), custom authentication handlers and resource configurations. These are critical for managing access, authentication, and resource handling in an application that involves both admin and user modules.
• Build & Deployment Infrastructure: Files like pom.xml, Maven wrapper scripts (mvnw, mvnw.cmd) and related directories (.mvn/) indicate that Maven is used for dependency management and build processes.
Relationships and Interactions
• Controller to Service: Show that each controller delegates to its corresponding service (e.g., ProductController calls ProductService methods).
• Service to Repository: Indicate that business logic in the service layer communicates with the repository layer to interact with the underlying database.
• Views/Resources Interaction: On the presentation side, show how the controller interacts with HTML templates and static assets to render responses.
Architectural Patterns
• MVC Pattern: Emphasize the separation into Model, View, and Controller components, where the controllers orchestrate between the UI and business logic.
• Layered Architecture: Illustrate the separation of concerns between presentation, business logic, and data access layers.
• Dependency Injection & Service Layer: Note that Spring’s dependency injection plays a key role in connecting the layers, which is reflected in service implementations and controllers.
• Security Framework Integration: Call out the use of Spring Security components (CustomAuthenticationSuccessHandler, SecurityConfig) along with resource configuration.
Relevant Technologies and Frameworks
• Spring Boot: For overall application configuration, dependency injection, and web MVC framework.
• Spring Security: For implementing authentication and authorization mechanisms.
• Maven: For build and dependency management.
• Thymeleaf or similar templating engines: Implied from the templates directory.
• JDBC (and likely JPA): Indicated by the presence of “Jdbc*Repository” classes which suggest a direct Data Access implementation in parts of the project.