Backend Development 4 min read

How mica-auto Automates Spring Boot Starter Configuration with Annotation Processors

This article explains the mica-auto library, which uses Java annotation processing to automatically generate Spring Boot starter configurations, streamline component registration, and simplify multi‑module Spring Cloud projects, while providing Maven and Gradle integration details and recent change logs.

Java Architecture Diary
Java Architecture Diary
Java Architecture Diary
How mica-auto Automates Spring Boot Starter Configuration with Annotation Processors

Introduction

mica-auto works by leveraging Java Annotation Processor technology to automatically generate essential Spring Boot starter configurations during compilation. It is widely used in Spring Cloud's core component Mica as well as in projects like pig and Springblade.

Features

Generates classes annotated with

@Component

into

spring.factories

.

Creates

spring-devtools.properties

.

Combines

spring-boot-configuration-processor

and

spring-boot-autoconfigure-processor

to avoid excessive dependencies.

Generates

@FeignClient

interfaces into

spring.factories

for automatic Feign configuration in Mica.

Change Log

[1.1.0] - 2019-05-24

Additions

Add

@AutoContextInitializer

supporting

org.springframework.context.ApplicationContextInitializer

.

Add

@AutoListener

supporting

org.springframework.context.ApplicationListener

.

Add

@AutoFailureAnalyzer

supporting

org.springframework.boot.diagnostics.FailureAnalyzer

.

Dependency Upgrades

Upgrade Gradle to

5.4.1

.

Upgrade Google Auto to

1.0-rc5

.

Upgrade Lombok to

1.18.8

.

Upgrade Spring Boot to

2.1.5.RELEASE

.

Usage

Note: If your project uses Lombok, place the

mica-auto

dependency after Lombok.

Maven

<code>&lt;dependency&gt;
  &lt;groupId&gt;net.dreamlu&lt;/groupId&gt;
  &lt;artifactId&gt;mica-auto&lt;/artifactId&gt;
  &lt;version&gt;1.1.0&lt;/version&gt;
  &lt;scope&gt;provided&lt;/scope&gt;
&lt;/dependency&gt;</code>

Gradle >= 5.x

<code>annotationProcessor("net.dreamlu:mica-auto:1.1.0")</code>

Gradle < 5.x

<code>compileOnly "net.dreamlu:mica-auto:1.1.0"</code>

Usage Scenarios

The library helps avoid inconsistencies between the main Spring Boot project's package and sub‑project or module packages, preventing class‑scanning issues.

Typical scenarios include:

Custom Spring Boot starter development.

Multi‑module projects where sub‑projects should not add the dependency to the main project.

BackendJavadependency managementSpring BootAnnotation ProcessorMica
Java Architecture Diary
Written by

Java Architecture Diary

Committed to sharing original, high‑quality technical articles; no fluff or promotional content.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.