lets-mica/mica-auto
About
mica-auto 使用注解自动生成 java spi 和 Spring boot 的配置。🔝🔝 记得右上角点个star 关注更新!
Web & App DevelopmentMeasured star growth
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- 0
- in 1 month
- Collecting history
Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.
README_EN.md
Originalmica-auto SPI、Spring boot starter Development Tools
Mica-auto is a basic component of the Spring Cloud microservices framework MICA, which is used to generate some basic configurations of the Spring Boot Starter.
English | 简体中文
version
| version | spring boot version | java version |
|---|---|---|
| 4.0.0 | 4.x | 17 |
| 3.1.6 | 3.x | 17 |
| 2.3.5 | 1.x ~ 3.x | 1.8 |
Principle
Mica Auto uses the Annotation Processor, which is not a new technology. It's been around since JDK 1.6. The Annotation Processor is a tool of javac that scans and processes annotations at compile time. Using the Annotation Processor, you can obtain information about annotations and annotated objects, and then automatically generate Java code based on annotations, eliminating manual writing and improving coding efficiency. Lombok is also famous for this technology.
Usage Scenarios
It is mainly used to avoid the inconsistency between the Spring Boot main project package and the subproject or submodule package, and avoid the problem that the package cannot be scanned. .Customize the Spring Boot starter. .Subprojects in a multi-module project (adding MICA-Auto to a master project is not recommended).
Functions
- Automatically generate
spring.factories,spring-devtools.propertiesconfiguration (spring Boot starter development tools). - Generate the
FeignClientin the spring.factories for automated Feign configuration in the mica-cloud. - Generate the
Java Spiconfiguration, you need to add the@AutoServiceannotation.
| Annotation | spring.factories or Spi key |
|---|---|
| @AutoContextInitializer | ApplicationContextInitializer |
| @AutoListener | ApplicationListener |
| @AutoRunListener | SpringApplicationRunListener |
| @AutoEnvPostProcessor | EnvironmentPostProcessor |
| @AutoFailureAnalyzer | FailureAnalyzer |
| @AutoConfigImportFilter | AutoConfigurationImportFilter |
| @AutoTemplateProvider | TemplateAvailabilityProvider |
| @AutoEnableCircuitBreaker | EnableCircuitBreaker |
| @AutoConfigDataLocationResolver | ConfigDataLocationResolver |
| @AutoConfigDataLoader | ConfigDataLoader |
| @AutoDatabaseInitializerDetector | DatabaseInitializerDetector |
| @AutoDependsOnDatabaseInitializationDetector | DependsOnDatabaseInitializationDetector |
| @Component | EnableAutoConfiguration |
| @AutoIgnore | Ignore and do not generate to spring.factories |
| @AutoService | java Spi generates the configuration |
| Annotation | aot.factories |
|---|---|
| @AotRuntimeHintsRegistrar | RuntimeHintsRegistrar |
| @AotBeanRegistration | BeanRegistrationAotProcessor |
| @AotBeanFactoryInitialization | BeanFactoryInitializationAotProcessor |
Usage
Note: If you are using Lombok in your project, place the mica-Auto dependency behind Lombok。
maven
<dependency>
<groupId>net.dreamlu</groupId>
<artifactId>mica-auto</artifactId>
<version>${mica-auto.version}</version>
<scope>provided</scope>
</dependency>
gradle >= 5.x
annotationProcessor("net.dreamlu:mica-auto:$micaAutoVersion}")
gradle < 5.x
compileOnly "net.dreamlu:mica-auto:2.3.2"
Principle
Scan @component, automatically generate the corresponding configuration, and support composite annotations.
Mica Ecological
- mica (Spring cloud micro service component): https://gitee.com/596392912/mica
- mica-auto (Spring boot starter development tools): https://gitee.com/596392912/mica-auto
- mica-weixin ( jfinal weixin’s spring boot starter ):https://gitee.com/596392912/mica-weixin
- mica-mqtt (mqtt component based on t-io implementation):https://gitee.com/596392912/mica-mqtt
- Spring cloud Microservice http2 solution( h2c ): https://gitee.com/596392912/spring-cloud-java11
Open Source Licenses
LGPL(GNU Lesser General Public License)
The User’s Rights
Allow to introduce the source code in the form of free for study, graduation, corporate projects, private work, etc. Modify the code in special cases, but still want to close the source must be approved by the author. For reference, please specify: refer to mica-auto: https://github.com/lets-mica/mica-auto
References
- Google Auto: https://github.com/google/auto
- Spring 5 - spring-context-indexer:https://github.com/spring-projects/spring-framework/tree/master/spring-context-indexer
WeChat Official Account

Explore related projects
Loading…