spring-axum-macros
Procedural macros for spring-axum: auto discovery, controllers, components, interceptors, transactions, caching, events, and SQL/Mapper.
Repository: https://gitee.com/luzhihaoTestingLab/spring-axum.git
Examples
use spring_axum_macros::{controller, route_get, component, interceptor, transactional, cacheable, event_listener, sql, mapper};
#[controller(hello)]
struct UserController;
#[route_get("/users/:id")]
async fn get_user(id: i64) -> String { format!("{}", id) }
#[component]
#[derive(Default)]
struct MyService;
#[interceptor]
#[derive(Default, Clone)]
struct MyInterceptor;
#[mapper]
impl UserMapper {
#[sql("SELECT * FROM users WHERE id = #{id}")]
async fn find_by_id(&self, id: i64) -> anyhow::Result<User> { todo!() }
}
See the root repository README for detailed usage.
License
MIT