軟件推薦丨mica-auto——微服務框架代碼自動生成

軟件推薦丨mica-auto——微服務框架代碼自動生成

點擊右上方,關注開源中國OSC頭條號,獲取最新技術資訊

mica-auto 代碼自動生成

mica-auto 是 Spring cloud 微服務框架 Mica 中的一個基礎組件,用來生成 Spring boot 的一些基礎配置。

功能

  1. 生成 spring.factories
  2. 生成 spring-devtools.properties
  3. 生成 FeignClient 到 spring.factories 中,供 mica 中完成 Feign 自動化配置。

使用

maven


net.dreamlu
mica-auto
1.0.0
provided

gradle >= 5.x

annotationProcessor("net.dreamlu:mica-auto:1.0.0")

gradle < 5.x

compileOnly "net.dreamlu:mica-auto:1.0.0"

原理

掃描 @Configuration,自動生成相應的配置。

注意: v1.0.0 已經支持組合註解。

初衷

在編寫 Spring boot 相關插件的時候經常需要編寫和修改 spring.factories 文件,其中有一次忘記修改,導致服務啟動報錯。想到編譯期間自動生成這種配置。

開源協議

LGPL(GNU Lesser General Public License)

參考

Google Auto: https://github.com/google/auto

Spring 5 - spring-context-indexer:https://github.com/spring-projects/spring-framework/tree/master/spring-context-indexer

↓↓↓


分享到:


相關文章: