【GHS】Solon 1.2.13 发布

编程开发   © 文章版权由 admin 解释,禁止匿名转载

#楼主# 2020-12-30

Solon 一个类似Springboot的微型开发框架。项目从2018年启动以来,参考过大量前人作品;历时两年,3500多次的commit;内核保持0.1m的身材,超高的Web跑分,良好的使用体验。Solon 强调:克制 + 简洁 + 开放的原则;力求:更小、更快、更自由的体验。所谓更小:内核0.1m,最小Web开发单位0.2m(相比Springboot项目包,小到可以乎略不计了)所谓更快:本机helloworld测试,Qps可达12万之多。可参考:《helloworld_wrk_test》所谓更自由:(代码操控自由)// 除了注入模式之外,还可以按需手动////手动获取配置Map db = Solon.cfg().getMap("db");//手动获取容器里的BeanUserService userService = Aop.get(UserService.class);//手动监听http post请求Solon.global().post("/user/update", x-> userService.updateById(x.paramMap()));本次版本重大变更:1、增加插件:springboot-solon-plugin(实现与Springboot互通)引入框架,约0.1m大小 org.noear springboot-solon-plugin 1.2.13? 如果有需要可引入Solon的其它插件,Solon适配的框架多较小巧 ?嵌入Springboot系统后,同时利用两套框架的容器资源与特性;或者过度期临时混合启动应用@SpringBootLinkSolon@SpringBootApplicationpublic class DemoApp { public static void main(String[] args) { //先 Solon.start(DemoApp.class, args); //后 SpringApplication.run(DemoApp.class, args); }}定义Springboog组件public interface HelloService { String hello(String name);}//此处为Springboot的注解(Solon 也有同名的注解)@Componentpublic class HelloServiceImp implements HelloService { @Override public String hello(String name) { return "hello: " + name; }}在Solon类里使用Springboot容器内的组件//此处为Solon的注解(Springboot 也有同名的注解)@Controllerpublic class SolonController { //使用Solon注解,将Springboot bean注入到Solon的托管类中 @Inject HelloService helloService; //注入配置 @Inject("${user.name}") String name; @Mapping("/test") public String home(String msg) throws Exception { return "solon: " + helloService.hello(); }}

成为第一个回答人

评论

登录后才可发表内容
  • 主题

    10

  • 帖子

    48

  • 关注者

    0

Copyright © 2019 凯特网.   Powered by HYBBS 2.3.4  

Runtime:0.0847s Mem:2047Kb