# 15853860880/springboot-demo architecture

> Architecture diagram of the GitHub repository 15853860880/springboot-demo, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/15853860880/springboot-demo
- Repository: https://github.com/15853860880/springboot-demo

## Overview

This project is a multi-module Spring Boot demo repository that integrates a broad range of common development tools and middleware components. The purpose is to illustrate how to set up and integrate components such as Redis, MyBatisPlus, RocketMQ, RabbitMQ, Elasticsearch, Quartz, Xxl-Job, Kafka, and more into a Spring Boot application. Each module (for example, actuator-demo, admin-demo, aop-demo, docker-demo, etc.) demonstrates a particular aspect or integration pattern.

##### Main Components
- Each module (demo) is essentially its own Spring Boot application, complete with its own controllers, services, configurations, and test suites.
- Key components include:
- Web/API layer: Controllers in each module handling HTTP (or WebSocket) requests.
- Business Logic/Service layer: Service classes, including implementations like TestService, etc.
- Data Access/Configuration: Integration examples for multiple data source configurations, MyBatis, sharding setups, etc.
- External Integrations: Each demo that talks to Redis, RabbitMQ, Kafka, Elasticsearch, Minio, etc.
- Cross-cutting concerns: AOP configurations, global exception handling, logging (Logback), and security settings in some modules.

##### Relationships and Interactions
- Although the modules are largely independent demos, they share common architectural patterns.
- Within each module, the typical flow starts at a Controller, then moves to a Service and may interact with a Repository (or directly via a mapper) to perform CRUD operations or send/receive messages.
- There are interactions with external systems such as message brokers (RocketMQ, RabbitMQ, Kafka), search engines (Elasticsearch), file storage (Minio), and even scheduling systems (Quartz, Xxl-Job).
- In some cases, AOP is used to intercept HTTP requests for encryption/decryption or for dynamic data source switching.

##### Architectural Patterns and Design Principles
- Modular design: The multi-module Maven project structure clearly separates different responsibilities and examples.
- Microservice-like structure: Even if these are demos, each module functions independently like a microservice.
- Layered architecture: Standard separation between controller, service, and data access layers.
- Cross-cutting concerns managed with AOP: See use in modules like aop-demo and dynamicmultipledatasources-demo.
- Clear external integration: Each demo module encapsulates its specific middleware integration with dedicated configuration and utility classes.

##### Relevant Technologies and Frameworks
- Spring Boot as the application framework.
- Integration libraries and clients: MyBatisPlus, RocketMQ, RabbitMQ, Kafka, Elasticsearch REST client.
- Additional frameworks: Quartz for scheduling, Knife4j for API documentation, Thymeleaf for templating, etc.
- Tools: Docker (docker-demo), Logback for logging, and Minio for file storage.

##### Elements
o Controllers – indicating entry points for client interactions.
o Services – denoting business logic and use of support utilities.
o Configuration / Utility classes – used for setting up the integration with external systems.
o From external clients to controllers.
o From controllers to services.
o From services to external systems like Redis, Kafka, and databases.
o Internal application components (e.g., rectangles for controllers and services).

- Overall level: Present an "umbrella" view with all independent modules.
- Module-specific level: Zoom in on one or two modules to show detailed flows (for example, the flow in the dynamicmultipledatasources-demo or the AOP demos).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External Client
    Client("External Client"):::external

    %% Actuator Demo Module
    subgraph "Actuator Demo"
        A1("TestController (Controller)"):::controller
        A2("Actuator Service"):::service
        A1 -->|"calls"| A2
    end
    Client --> A1

    %% Admin Demo Module
    subgraph "Admin Demo"
        B1("AdminClientApplication (Admin Client)"):::controller
        B2("AdminServerApplication (Admin Server)"):::service
        B1 -->|"communicates"| B2
    end
    Client --> B1

    %% AOP Demo Module
    subgraph "AOP Demo"
        C1("HttpCheckAspact (AOP)"):::aop
        C2("KeyConfig (Configuration)"):::config
        C1 -->|"configuredBy"| C2
    end

    %% Redis Demo Module
    subgraph "Redis Demo"
        D1("RedisConfig (Redis Integration)"):::config
    end

    %% MyBatisPlus Demo Module
    subgraph "MyBatisPlus Demo"
        E1("MybatisPlusConfig (Config)"):::config
        E2("Mappers (Data Access)"):::repository
        E1 -->|"enables"| E2
    end

    %% RocketMQ Demo Module
    subgraph "RocketMQ Demo"
        F1("RocketmqApplication (Messaging)"):::service
    end

    %% RabbitMQ Demo Module
    subgraph "RabbitMQ Demo"
        G1("RabbitMqConfig (Messaging Config)"):::config
    end

    %% Elasticsearch Demo Module
    subgraph "Elasticsearch Demo"
        H1("ElasticSearchClientConfig (Search Integration)"):::config
    end

    %% Quartz Demo Module
    subgraph "Quartz Demo"
        I1("QuartzConfig (Scheduling Config)"):::config
        I2("Job Components"):::service
        I3("Manager Components"):::service
        I1 -->|"triggers"| I2
        I2 -->|"managedBy"| I3
    end

    %% Xxl-Job Demo Module
    subgraph "Xxl-Job Demo"
        J1("XxlJobConfig (Job Scheduling)"):::config
    end

    %% Kafka Demo Module
    subgraph "Kafka Demo"
        K1("KafkaApplication (Messaging)"):::service
    end

    %% Docker Demo Module
    subgraph "Docker Demo"
        L1("DockerApplication (Containerization)"):::service
    end

    %% Minio Demo Module
    subgraph "Minio Demo"
        M1("MinioConfig (File Storage)"):::config
    end

    %% Dynamic Datasources Demo Module
    subgraph "Dynamic Datasources Demo"
        N1("DynamicDataSourceConfig (Dynamic Data Source)"):::config
    end

    %% Static Datasources Demo Module
    subgraph "Static Datasources Demo"
        O1("DB1DataSourceConfig (Static DS)"):::config
        O2("DB2 DataSourceConfig (Static DS)"):::config
        O1 -->|"with"| O2
    end

    %% External Systems
    subgraph "External Systems"
        R("Redis"):::external
        RMQ("RocketMQ"):::external
        RAB("RabbitMQ"):::external
        ES("Elasticsearch"):::external
        QZ("Quartz"):::external
        XXL("Xxl-Job"):::external
        KF("Kafka"):::external
        MINIO("Minio"):::external
        DB("Database"):::external
    end

    %% Module to External System Connections
    D1 -->|"connects"| R
    F1 -->|"sendsMessages"| RMQ
    G1 -->|"sendsMessages"| RAB
    H1 -->|"queries"| ES
    I1 -->|"schedules"| QZ
    J1 -->|"triggers"| XXL
    K1 -->|"publishes"| KF
    M1 -->|"storesFiles"| MINIO
    E2 -->|"CRUDOps"| DB
    N1 -->|"dynamicDS"| DB
    O1 -->|"staticDS"| DB
    O2 -->|"staticDS"| DB

    %% Click Events
    click A1 "https://github.com/15853860880/springboot-demo/blob/master/actuator-demo/src/main/java/com/luoyu/actuator/controller/TestController.java"
    click B1 "https://github.com/15853860880/springboot-demo/blob/master/admin-demo/admin-client/src/main/java/com/luoyu/adminclient/AdminClientApplication.java"
    click B2 "https://github.com/15853860880/springboot-demo/blob/master/admin-demo/admin-server/src/main/java/com/luoyu/adminserver/AdminServerApplication.java"
    click C1 "https://github.com/15853860880/springboot-demo/blob/master/aop-demo/src/main/java/com/luoyu/aop/aop/HttpCheckAspact.java"
    click C2 "https://github.com/15853860880/springboot-demo/blob/master/aop-demo/src/main/java/com/luoyu/aop/config/KeyConfig.java"
    click D1 "https://github.com/15853860880/springboot-demo/blob/master/redis-demo/src/main/java/com/luoyu/redis/config/RedisConfig.java"
    click E1 "https://github.com/15853860880/springboot-demo/blob/master/mybatisplus-demo/src/main/java/com/luoyu/mybatisplus/config/MybatisPlusConfig.java"
    click E2 "https://github.com/15853860880/springboot-demo/tree/master/mybatisplus-demo/src/main/java/com/luoyu/mybatisplus/mapper"
    click F1 "https://github.com/15853860880/springboot-demo/blob/master/rocketmq-demo/src/main/java/com/luoyu/rocketmq/RocketmqApplication.java"
    click G1 "https://github.com/15853860880/springboot-demo/blob/master/rabbitmq-demo/src/main/java/com/luoyu/rabbitmq/config/RabbitMqConfig.java"
    click H1 "https://github.com/15853860880/springboot-demo/blob/master/elasticsearch-demo/src/main/java/com/luoyu/elasticsearch/config/ElasticSearchClientConfig.java"
    click I1 "https://github.com/15853860880/springboot-demo/blob/master/quartz-demo/src/main/java/com/luoyu/quartz/config/QuartzConfig.java"
    click J1 "https://github.com/15853860880/springboot-demo/blob/master/xxljob-demo/src/main/java/com/luoyu/xxljob/config/XxlJobConfig.java"
    click K1 "https://github.com/15853860880/springboot-demo/blob/master/kafka-demo/src/main/java/com/luoyu/kafka/KafkaApplication.java"
    click L1 "https://github.com/15853860880/springboot-demo/blob/master/docker-demo/src/main/java/com/luoyu/docker/DockerApplication.java"
    click M1 "https://github.com/15853860880/springboot-demo/blob/master/minio-demo/src/main/java/com/luoyu/minio/config/MinioConfig.java"
    click N1 "https://github.com/15853860880/springboot-demo/blob/master/dynamicmultipledatasources-demo/src/main/java/com/luoyu/dynamicmultipledatasources/config/DynamicDataSourceConfig.java"
    click O1 "https://github.com/15853860880/springboot-demo/blob/master/staticmultipledatasources-demo/src/main/java/com/luoyu/staticmultipledatasources/config/DB1DataSourceConfig.java"
    click O2 "https://github.com/15853860880/springboot-demo/tree/master/staticmultipledatasources-demo"

    %% Styles
    classDef controller fill:#f8b500,stroke:#333,stroke-width:2px;
    classDef service fill:#90ee90,stroke:#333,stroke-width:2px;
    classDef config fill:#add8e6,stroke:#333,stroke-width:2px;
    classDef repository fill:#ffcccb,stroke:#333,stroke-width:2px;
    classDef external fill:#d3d3d3,stroke:#333,stroke-width:2px;
    classDef aop fill:#dda0dd,stroke:#333,stroke-width:2px;
```
