1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
//! # Verdure - An Ecosystem Framework for Rust
//!
//! Verdure is a comprehensive **ecosystem framework** for Rust, Verdure aims to be the foundation
//! for building robust, scalable, and maintainable Rust applications across various domains.
//!
//! True to its name, Verdure represents a vibrant and thriving ecosystem framework, dedicated to
//! facilitating convenient and efficient Rust development through a cohesive set of tools and patterns.
//!
//! ## Framework Philosophy
//!
//! Verdure follows the **"Convention over Configuration"** and **"Batteries Included"** philosophies:
//!
//! - **Opinionated yet Flexible**: Provides sensible defaults while allowing customization
//! - **Ecosystem Integration**: Seamless integration between different framework modules
//! - **Developer Experience**: Focus on developer productivity and code maintainability
//! - **Production Ready**: Built for real-world applications with performance and reliability in mind
//!
//! ## Ecosystem Modules
//!
//! Verdure is architected as a modular ecosystem:
//!
//! ### Core Foundation
//! - ✅ **verdure-core**: Foundation types, error handling, and common utilities
//! - ✅ **verdure-ioc**: Dependency injection container and component management
//! - ✅ **verdure-macros**: Compile-time code generation and annotation processing
//!
//! ### Application Framework
//! - ✅ **verdure-context**: Application context and configuration management
//!
//! ### Planned Modules
//!
//! ### Web & Network (Planned)
//! - TODO
//! ### Data & Persistence (Planned)
//! - TODO
//!
//! ### Security & Authentication (Planned)
//! - TODO
//!
//! ### Integration & Messaging (Planned)
//! - TODO
//!
//! ### Observability & Operations (Planned)
//! - TODO
//!
//! ### Testing & Development (Planned)
//! - TODO
//!
//! ## Current Features (v0.0.5)
//!
//! The current release provides a comprehensive foundation with application context support:
//!
//! - ✅ **Dependency Injection**: Comprehensive IoC container with automatic resolution
//! - ✅ **Component Lifecycle**: Singleton and prototype scopes with lifecycle events
//! - ✅ **Annotation-Driven**: `#[derive(Component)]` and `#[autowired]` for declarative configuration
//! - ✅ **Event System**: Container and component lifecycle event handling
//! - ✅ **Circular Dependency Detection**: Prevents infinite dependency loops
//! - ✅ **Thread Safety**: Full concurrent access support for multi-threaded applications
//! - ✅ **Application Context**: Comprehensive application context management and event system
//! - ✅ **Auto-Configuration**: Automatic configuration file reading and component assembly
//! - ✅ **Multi-Format Configuration**: YAML, TOML, and Properties file format support
//! - ✅ **Default Value Support**: `#[config_default]` and `#[config_default_t]` attributes
//!
//! ## Quick Start
//!
//! Add Verdure to your `Cargo.toml`:
//!
//! ```toml
//! [dependencies]
//! verdure = "0.0.5"
//! inventory = "0.3" # Required for component discovery
//! ```
//!
//! ### Building Your First Application
//!
//! #### ApplicationContext Approach (Recommended)
//!
//! Create a configuration file `application.yml`:
//!
//! ```yaml
//! server:
//! name: MyApp
//! port: 8080
//! database:
//! host: localhost
//! username: app_user
//! password: secret123
//! ```
//!
//! ```rust,ignore
//! use verdure::{ApplicationContext, Configuration, Component};
//! use verdure::event::{ContextAwareEventListener, ContextInitializingEvent};
//! use std::sync::Arc;
//!
//! // Auto-loaded configuration
//! #[derive(Debug, Configuration)]
//! #[configuration("server")]
//! struct ServerConfig {
//! name: Option<String>,
//! #[config_default(8080)]
//! port: Option<u32>,
//! }
//!
//! #[derive(Debug, Configuration)]
//! #[configuration("database")]
//! struct DatabaseConfig {
//! #[config_default("localhost")]
//! host: Option<String>,
//! username: Option<String>,
//! password: Option<String>,
//! }
//!
//! // Business components
//! #[derive(Component)]
//! struct UserService {
//! #[autowired]
//! repository: Arc<UserRepository>,
//! }
//!
//! #[derive(Component)]
//! struct UserRepository;
//!
//! // Application startup listener
//! struct AppStartupListener;
//!
//! impl ContextAwareEventListener<ContextInitializingEvent> for AppStartupListener {
//! fn on_context_event(
//! &self,
//! _event: &ContextInitializingEvent,
//! context: &ApplicationContext
//! ) {
//! // Access configuration components
//! let server_config = context.get_component::<ServerConfig>().expect("ServerConfig not found");
//! let db_config = context.get_component::<DatabaseConfig>().expect("DatabaseConfig not found");
//!
//! println!("Starting {} on port {}",
//! server_config.unwrap().name.unwrap_or_default(),
//! server_config.unwrap().port.unwrap_or(8080));
//! // Register components with the context, for example:
//! // context.register_component(Arc::new(DataSource::init(db_config.clone())));
//! }
//! }
//!
//! fn main() -> Result<(), Box<dyn std::error::Error>> {
//! // Create and initialize application context
//! let context = ApplicationContext::builder()
//! .with_config_file("application.yml")
//! .build()?;
//!
//! // Subscribe to context events
//! context.subscribe_to_context_events(AppStartupListener);
//!
//! // Initialize the context (auto-loads configs, wires dependencies)
//! context.initialize()?;
//!
//! // Get your services with all dependencies and config injected
//! let user_service: Arc<UserService> = context
//! .get_component()
//! .ok_or("UserService not found")?;
//!
//! // Your application is ready!
//! Ok(())
//! }
//! ```
//!
//! #### Traditional IoC Container Approach
//!
//! ```rust,ignore
//! use verdure::{Component, ComponentContainer, ComponentFactory};
//! use std::sync::Arc;
//!
//! #[derive(Component)]
//! struct UserService {
//! #[autowired]
//! repository: Arc<UserRepository>,
//! }
//!
//! #[derive(Component)]
//! struct UserRepository;
//!
//! fn main() -> Result<(), Box<dyn std::error::Error>> {
//! let container = ComponentContainer::new();
//! container.initialize()?;
//!
//! let user_service: Arc<UserService> = container
//! .get_component()
//! .ok_or("UserService not found")?;
//!
//! Ok(())
//! }
//! ```
//!
//! ## Roadmap & Vision
//!
//! Verdure aims to become the a comprehensive ecosystem
//! that covers all aspects of enterprise application development:
//!
//! ### Phase 1: Foundation (✅ Complete - v0.0.5)
//! - Core IoC container and dependency injection
//! - Component lifecycle and event system
//! - Application context management
//! - Auto-configuration and configuration management
//!
//! ### Phase 2: Enhanced Application Framework (v0.1.x)
//! - Advanced configuration profiles and environments
//! - Application bootstrapping enhancements
//! - Enhanced event system with more lifecycle events
//!
//! ### Phase 3: Web & Data (v0.2.x)
//! - Full-featured web framework with MVC patterns
//! - Data access patterns and ORM integration
//! - Transaction management and caching
//!
//! ### Phase 4: Enterprise Features (v0.3.x+)
//! - Security and authentication framework
//! - Message-driven architecture and integration patterns
//! - Observability and production-ready tools
//!
//! ## Design Principles
//!
//! 1. **Type Safety**: Leverage Rust's type system for compile-time guarantees
//! 2. **Zero-Cost Abstractions**: Performance should not be sacrificed for convenience
//! 3. **Ecosystem Coherence**: All modules work together seamlessly
//! 4. **Convention over Configuration**: Sensible defaults with customization options
//! 5. **Developer Experience**: Focus on productivity and code maintainability
//! 6. **Production Ready**: Built for real-world, high-performance applications
//!
//! ## Community & Contribution
//!
//! Verdure is designed to be a community-driven ecosystem framework. We welcome contributions
//! across all modules and encourage the development of third-party extensions that integrate
//! with the Verdure ecosystem.
//!
//! Join us in building the future of Rust application development!
// Re-export the Component derive macro
pub use Component;
pub use Configuration;
// Re-export error handling types
pub use error;
// Re-export the lifecycle_listener macro
pub use lifecycle_listener;
// Re-export all IoC container types and traits
pub use ;
// Re-export context module types and traits
pub use ;