天天看點

Solon 1.6.15 釋出,增加部分jdk17特性支援

關于官網

千呼萬喚始出來: https://solon.noear.org 。整了一個月多了。。。還得不斷接着整!

關于 Solon

Solon 是一個輕量級應用開發架構。支援 Web、Data、Job、Remoting、Cloud 等任何開發場景。短小而精悍!

  • 強調,克制 + 簡潔 + 開放的原則
  • 力求,更小、更快、更自由的體驗

目前已有近130個生态插件,含蓋了日常開發的各種需求。

關于 Solon Cloud

Solon Cloud 定義了一系列分布式開發的接口标準和配置規範,相當于DDD模式裡的防腐層概念。是 Solon 的微服務架構模式開發解決方案。

本次主要更新

  • 增加對 kotlin data class 和 jdk14+ record 的序列化、反序列化及注入支援
public record User(String username, Integer age) { }

@Controller
public class DemoController{
    @Mapping("/test")
    public void test(User user){
    }
}
           
  • @Service 增加 name, typed 屬性
//通過 name 指定 bean name;通過 typed 注冊類型 bean,即 DemoService 的預設實作
@Service(name="DemoService-CN", typed=true)
public class DemoServiceCnImpl implements DemoService{

}

//上面這種方式需要“編譯時”确定預設bean(注:當沒有name時,都是預設bean)
//
//基于Solon的特性,還有一種“運作時”确定的方案
//
@Service(name="DemoService-CN")
public class DemoServiceCnImpl implements DemoService{
    public DemoServiceCnImpl(){
        if("CN".equals(Solon.cfg().get("datacenter.region", "CN"))){
            Aop.wrapAndPut(DemoService.class, this);
        }
    }
}
           
  • 優化 sqltoy-solon-plugin 插件,增加便利的多資料源控制和切換
@Service
public class DemoService{
    @Db
    SqlToyLazyDao dao1;
    
    @Db("db2")
    SqlToyLazyDao dao2;
}
           
  • 新增 solon.extend.async 插件
@Service
public class AsyncTask {
    //會被異步運作(送出到異步執行器運作)//不要有傳回值(傳回也拿不到)
    @Async
    public void test(String hint){
        System.out.println(Thread.currentThread().getName());
    }
}
           
  • 修複 當主應用配置有變量時,應用環境配置無法替換的問題
  • 優化 Aop.beanForeach ,進行去重處理
  • 增加 三種日期格式自動解析

快速了解 Solon

《想法與架構筆記》

《生态預覽》

《與 Spring Boot 的差別?》

《與 Spring Cloud 的差別?》

項目位址

  • Gitee:https://gitee.com/noear/solon
  • Github:https://github.com/noear/solon