Solon 1.6.15 发布,增加部分jdk17特性支持

关于官网

千呼万唤始出来: //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 的区别?》

项目地址