How visualkhh/simple-boot works
Main System Components
• Core Module (“cores/simple”): This is the foundation of the framework. It includes the bootstrapping, dependency injection, AOP support (e.g., the “anno” and “aop” packages), configuration handling, transaction management, and proxy utilities. It’s essentially the core engine that supports the remaining modules.
• Database Modules (“dbs”):
– simple-db: The core interface for database access (via DatabaseAccessor) and transaction management.
– simple-db-h2: A specific implementation using H2, with starter and configuration classes.
– simple-db-hibernate: A Hibernate-based implementation that provides configuration, access management, and transaction management through its own classes.
• Web Modules (“webs”):
– simple-web: The basic web component that contains the core web server abstraction (using WebServer) and request/response management.
– simple-web-thymeleaf: A module that integrates a view resolver (likely using Thymeleaf) for templating.
– simple-web-netty: A module that leverages Netty for a non-blocking, reactive web server. It contains various packages for web communication, request dispatching, filtering, and exception handling.
• Example Project (“example”): Illustrates how to wire up the core, database, and web modules into a unified, running application. It shows sample controllers, services, and demonstrates using dependency injection and annotations for routing (e.g., @Controller, @Service, @GetMapping).
Relationships and Data Flow
• The core module is the backbone; every application built on simple-boot will invoke methods from this module during startup. It manages the dependency injection container, initializes beans (with annotations like @Injection, @PostConstruct), and configures core services (transaction management, configuration loading, proxying).
• The example project (and any application using this framework) depends on the following:
– It calls the core’s SimpleApplication to start.
– It uses the database modules by relying on the DatabaseAccessor and TransactionManager interfaces. Modules like simple-db-h2 and simple-db-hibernate listen to configuration and boot into the framework as beans.
– The web modules provide the web front end. For instance, controllers in the example use annotations from the core’s web packages to map requests to methods. The ViewResolver (in simple-web or simple-web-thymeleaf) is used to render responses.
– Dependency injection flows (e.g., from the framework’s container into controllers and services).
– Module dependencies where the core has an upward dependency (or a “bootstrapping” role) that initializes and wires in the database and web modules.
Architectural Patterns and Design Principles
• Modular Architecture: Each module (cores, dbs, webs) is separated clearly. This modular separation facilitates extension while keeping concerns isolated.
• Dependency Injection and Inversion of Control: Components such as controllers, services, and module starters are annotated to be automatically managed by the framework.
• Annotation-Driven Configuration: For instance, the use of annotations like @Controller, @Service, @Config, and @Transactional highlight the framework’s reliance on annotation processing for wiring functionalities.
• Aspect-Oriented Programming (AOP): With dedicated AOP packages and annotations (e.g., AopBefore, AopAfter), cross-cutting concerns can be managed neatly.
Final Recommendations for the Principal Software Engineer
– Data flow (for example, from Web controllers to Service layers, then to Database layers).
– Dependencies in terms of injection or initialization order.