# spring-axum
Spring-like application framework for Axum. It provides macro-driven auto discovery (controllers, components, interceptors, advices), validation, transactions, caching, events, and SQL/Mapper integrations to help you build maintainable web apps quickly.
Repository: https://gitee.com/luzhihaoTestingLab/spring-axum.git
## Quick Start
```rust
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let app = spring_axum::auto_discover!();
app.run().await
}
```
Or with explicit builder chain:
```rust
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let app = spring_axum::SpringApp::new()
.with_discovered_controllers()
.with_discovered_interceptors()
.with_discovered_advices()
.with_discovered_components();
app.run().await
}
```
## Features
- `#[controller]` and route macros (`#[route_get]`, `#[route_post]`, `#[route_put]`, `#[route_delete]`)
- `#[component]` for DI-style component auto registration
- `#[interceptor]` for request/response interception
- `#[transactional]` and `#[tx_service]` for transaction wrappers (enable `sqlx_postgres`)
- `#[cacheable]`, `#[cache_put]`, `#[cache_evict]` for in-memory caching
- Event publishing/subscription via `event_listener` macro
- MyBatis-style SQL mapping with `#[sql]` / `#[mapper]`
## Optional Features
Enable features in `Cargo.toml` as needed:
```toml
[dependencies]
spring-axum = { version = "0.1", features = ["validator", "swagger", "sqlx_postgres"] }
```
## License
MIT