feat: add dependency injection container #3
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Introduce a custom DI container in internal/app/ to centralize all application component initialization and wiring, following Clean Architecture principles and improving maintainability.
internal/app/di.go: Complete DI container implementation with lazy initialization, singleton pattern, and clean resource management
internal/app/di_test.go: Comprehensive test suite with 6 test cases
internal/app/README.md: Detailed documentation with examples and guides
REFACTORING_SUMMARY.md: Complete summary of refactoring changes
cmd/app/main.go: Simplified from 236 to 182 lines (-23%)
README.md: Updated project documentation
Lazy Initialization: Components created only on first access
Singleton Pattern: Each component initialized once and reused
Thread-Safe: Using sync.Once for concurrent access safety
Error Handling: Comprehensive error propagation and storage
Resource Cleanup: Unified Shutdown() method for all resources
Testability: Easily testable and mockable for integration tests