这一章里,把 JVM/.NET 后端看成“重工业企业城区”。这里的楼不是先追求轻巧,而是先追求长期稳定、组织协作和体系化配套。
#Spring Boot —— 生态最全的大都会
@SpringBootApplication
@RestController
class App {
@GetMapping("/")
String hello() { return "hello"; }
public static void main(String[] args) {
SpringApplication.run(App.class, args);
}
}Spring Boot 适合:
- 企业平台
- 复杂业务系统
- 需要大生态集成
#Quarkus —— 云原生效率城市
@Path("/")
public class HelloResource {
@GET
@Produces(MediaType.TEXT_PLAIN)
public String hello() {
return "hello";
}
}Quarkus 更强调:
- 容器
- 启动速度
- 低内存
- 云原生
#Micronaut —— 精密轻量城
@Controller("/")
class HelloController {
@Get
String hello() {
return "hello";
}
}Micronaut 的关键词:
- 编译期 DI / AOP
- 微服务
- serverless
- 更轻的运行时
#Ktor —— Kotlin-first 城区
fun main() = embeddedServer(Netty, port = 8080) {
routing {
get("/") { call.respondText("hello") }
}
}.start(wait = true)#ASP.NET Core —— 工程化极强的西雅图城区
var app = WebApplication.Create(args);
app.MapGet("/", () => "hello");
app.Run();它很适合:
- .NET 组织
- 企业平台
- 高性能 API
- 一体化平台能力
这一组的核心判断:
Spring Boot = 生态最稳
Quarkus = 云原生性能路线
Micronaut = 编译期轻量平衡
Ktor = Kotlin-first
ASP.NET Core = .NET 一体化默认答案