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 的區別?》

項目地址

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章