spring-axum

Crates.iospring-axum
lib.rsspring-axum
version0.1.3
created_at2025-10-13 15:35:31.474651+00
updated_at2025-10-17 15:53:16.875992+00
descriptionSpring-like application framework for Axum with macro-based auto discovery, validation, transactions, caching, events, and SQL/Mapper integrations.
homepagehttps://gitee.com/luzhihaoTestingLab/spring-axum
repositoryhttps://gitee.com/luzhihaoTestingLab/spring-axum.git
max_upload_size
id1880680
size139,212
luzhihaoTestingLab (luzhihaoTestingLab)

documentation

https://docs.rs/spring-axum

README

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

#[tokio::main]
async fn main() -> anyhow::Result<()> {
    let app = spring_axum::auto_discover!();
    app.run().await
}

Or with explicit builder chain:

#[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:

[dependencies]
spring-axum = { version = "0.1", features = ["validator", "swagger", "sqlx_postgres"] }

License

MIT

Commit count: 0

cargo fmt