4 个版本
| 新 0.0.7 | 2024 年 8 月 21 日 |
|---|---|
| 0.0.6 | 2024 年 8 月 17 日 |
| 0.0.5 | 2024 年 8 月 17 日 |
| 0.0.4 | 2024 年 8 月 7 日 |
#390 在 HTTP 服务器
每月 461 次下载
33KB
655 代码行
spring-rs 是用 Rust 编写的微服务框架,类似于 Java 中的 SpringBoot。 spring-rs 为集成 Rust 社区中的优秀项目(如 axum、sqlx、sea-orm 等)提供了一个易于扩展的插件系统。
示例
use spring::{get, auto_config, App};
use spring_web::{response::IntoResponse, WebConfigurator, WebPlugin};
#[auto_config(WebConfigurator)]
#[tokio::main]
async fn main() {
App::new()
.add_plugin(WebPlugin)
.run()
.await
}
#[get("/")]
async fn hello_world() -> impl IntoResponse {
"hello world"
}
支持的插件
-
spring-web(基于axum) -
spring-sqlx(集成sqlx) -
spring-sea-orm(集成sea-orm) -
spring-redis(集成redis) -
spring-mail(集成lettre) -
spring-job(集成tokio-cron-scheduler) -
spring-actuator(提供简单的健康检查和系统诊断接口) -
spring-stream(集成sea-streamer以实现消息处理) -
spring-opentelemetry(集成opentelemetry以实现日志、指标、跟踪的全可观察性)
依赖关系
~9–17MB
~217K SLoC