Java 新的应用开发框架:更快、更小、更简单。
启动快 5 ~ 10 倍;qps 高 2~ 3 倍;运行时内存节省 1/3 ~ 1/2;打包可以缩到 1/2 ~ 1/10;同时支持 jdk8, jdk11, jdk17, jdk21;支持 graalvm native image。
Java
Kotlin
Groovy
@Controller
public class App {
public static void main(String[] args) {
Solon.start(App.class, args, app -> {
//手写模式
app.get("/hello1", ctx -> ctx.output("Hello world!"));
});
}
//注解模式
@Get
@Socket
@Mapping("/hello2")
public String hello2(String name) {
return String.format("Hello %s!", name);
}
}
@Controller
class App {
static void main(String[] args){
Solon.start(App.class, args, app->{
//手写模式
app.get("/hello1", ctx -> ctx.output("Hello world!"))
})
}
//注解模式
@Get
@Socket
@Mapping("/hello2")
String hello(@Param(defaultValue = "world") String name) {
return String.format("Hello %s!", name)
}
}
@Controller
class App {
//注解模式
@Get
@Socket
@Mapping("/hello2")
fun hello(@Param(defaultValue = "world") name: String): String {
return String.format("Hello %s!", name)
}
}
fun main(args: Array<String>) {
Solon.start(App::class.java, args) { app ->
//手写模式
app.get("/hello1") { ctx -> ctx.output("Hello world!") }
}
}
我们的赞助商
暂无...