Spring Boot 轻量替代框架 Solon 1.3.18 发布

栏目: 软件资讯 · 发布时间: 4年前

内容简介:Solon 是一个微型的Java开发框架。项目从2018年启动以来,参考过大量前人作品;历时两年,4000多次的commit;内核保持0.1m的身材,超高的跑分,良好的使用体验。支持:RPC、REST API、MVC、WebSocket、Socket 等多...

Solon 是一个微型的 Java 开发框架。项目从2018年启动以来,参考过大量前人作品;历时两年,4000多次的commit;内核保持0.1m的身材,超高的跑分,良好的使用体验。支持:RPC、REST API、MVC、WebSocket、Socket 等多种开发模式。

Solon 强调:克制 + 简洁 + 开放的原则;力求:更小、更快、更自由的体验。

替代?那有什么异同之处?

《Solon 特性简集,相较于 Springboot 有什么区别?》

《Solon 的架构笔记》

所谓更小:

内核0.1m,最小开发单位0.2m(相比Dubbo、Springboot项目包,小到可以乎略不计)

所谓更快:

本机helloworld测试,Qps可达12万之多。可参考:《helloworld_wrk_test

所谓更自由:(代码操控自由)

// 除了注解模式之外,还可以按需手动
//
//手动获取配置(Props 为 Properties 增强版)
Props db = Solon.cfg().getProp("db");

//手动获取容器里的Bean
UserService userService = Aop.get(UserService.class);

//手动监听http post请求
Solon.global().post("/user/update", x-> userService.updateById(x.paramMap()));

//手动添加个RPC服务
Solon.global().add("/rpc/", HelloService.class, true);

//手动获取一个RPC服务消费端
HelloService helloService = Nami.builder().create(HelloService.class);

本次版本主要变化:

1、增加 luffy-solon-plugin 组件,实现与动态语言混合执行能力

//
// file: resources/luffy/hello.js
//
let name = ctx.param("name");

if(!name){
    name = "world";
}

return `Hello ${name}!`;

// 浏览器打开: http://localhost:8080/hello.js
// Java调用:CallUtil.callFile("/hello.js", null);

目前已适配的动态语言

  • python
  • ruby
  • javascript
  • groovy
  • lua
  • graaljs

2、Solon cloud 增加云端黑白名单接口 CloudListService

//手动应用
//
if(CloudClient.list().inList("blacklist","ip","127.0.0.1")){
    //提示
}

//注解应用
@NotBlanklist
@Mapping("demo1")
public void demo1(){
   //业务处理
}

@Withelist
@Mapping("demo2")
public void demo2(){
  //业务处理
}

3、增加 solon.logging 的异常格式化支持

@Slf4j
public class DemoService{
  public void demo(){
    try{
        //业务处理
    }catch(Exception ex){
        log.error("{}\r\n{}", "error:", ex);
    }
  }
}

4、增加 solon.extend.sessionstate.jwt 组件通过 header 传输的支持

附:入门示例


以上所述就是小编给大家介绍的《Spring Boot 轻量替代框架 Solon 1.3.18 发布》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Chinese Authoritarianism in the Information Age

Chinese Authoritarianism in the Information Age

Routledge / 2018-2-13 / GBP 115.00

This book examines information and public opinion control by the authoritarian state in response to popular access to information and upgraded political communication channels among the citizens in co......一起来看看 《Chinese Authoritarianism in the Information Age》 这本书的介绍吧!

HTML 压缩/解压工具
HTML 压缩/解压工具

在线压缩/解压 HTML 代码

随机密码生成器
随机密码生成器

多种字符组合密码

RGB HSV 转换
RGB HSV 转换

RGB HSV 互转工具