一个更现代感的 Java “生态型”应用开发框架:更快、更小、更自由。不是 Spring,没有 Servlet,也无关 JavaEE;新兴独立的轻量生态 (已有150来个生态插件) 。主框架仅 0.1 MB。

相对于 Spring Boot 和 Spring Cloud 的项目:

启动快 5 ~ 10 倍。 (更快)
qps 高 2~ 3 倍。 (更高)
运行时内存节省 1/3 ~ 1/2。 (更少)
打包可以缩小到 1/2 ~ 1/10;比如,300Mb 的变成了 23Mb。 (更小)
同时支持 jdk8, jdk11, jdk17, jdk19

似曾相似的体验,入门更简单:

@Controller
public class App {
public static void main(String[] args) {
Solon.start(App.class, args, app->{
//手写模式
app.get(“/”, ctx -> ctx.outputAsJson(“{message:’Hello world!’}”))
});
}

//注解模式
@Get
@Socket
@Mapping(“/hello”)
public String hello(@Param(defaultValue = “java”) String name) {
return String.format(“Hello %s!”, name);
}
}

入门探索视频(用户录制):

本次更新:

修复 solon.test :: @TestRollback 事务回滚坏掉的问题(v1.12.0 出现的)
增加 sa-token 拦截的新适配方式,旧的标为弃用。

@Configuration
public class Config {
@Bean(index = -100) //-100,是顺序位(低值优先)
public void tokenPathInterceptor() {
return new SaTokenInterceptor()….;
}
}

详见:https://solon.noear.org/article/110

增加 sa-token-dao json 序列化适配(现在有 base64 + json)
增加 RouterInterceptor::postResult 接口(即可以修改返回结果)

@Component
public class GlobalTransInterceptor implements RouterInterceptor {
@Inject
private TransService transService;

@Override
public void doIntercept(Context ctx, Handler mainHandler, RouterInterceptorChain chain) throws Throwable {
chain.doIntercept(ctx, mainHandler);
}

@Override
public Object postResult(Context ctx, Object result) throws Throwable {
//此处为拦截处理
if (result != null && !(result instanceof Throwable) && ctx.action() != null) {
result = transService.transOneLoop(result, true);
}

return result;
}
}

详见:https://solon.noear.org/article/242

增加 solon.serialization 所有 json 插件的统一快捷配置支持

solon.serialization.json:
dateAsFormat: ‘yyyy-MM-dd HH🇲🇲ss’ #配置日期格式(默认输出为时间戳)
dateAsTimeZone: ‘GMT+8’ #配置时区
dateAsTicks: false #将date转为毫秒数(和 dateAsFormat 二选一)
longAsString: true #将long型转为字符串输出 (默认为false)
boolAsInt: false #将bool型转为字符串输出 (默认为false)
nullStringAsEmpty: false
nullBoolAsFalse: false
nullNumberAsZero: false
nullArrayAsEmpty: false
nullAsWriteable: false #输出所有null值

详见:https://solon.noear.org/article/94

调整 安全停止时由 403 改为 503 状态码

solon.app.safeStop=1

详见:https://solon.noear.org/article/412

升级 snack3 为 3.2.52
升级 dbvisitor 为 5.2.0
升级 fastjson2 为 2.0.23

生态架构图:

进一步了解 Solon:

《想法与架构笔记》
《生态预览》
《与 Spring Boot 的区别?》
《与 Spring Cloud 的区别?》

项目仓库:

gitee:https://gitee.com/noear/solon
github:https://github.com/noear/solon

作者

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注

Generated by Feedzy
%d 博主赞过: