Effortlessly Manage Spring Boot Config Files with mica-auto

This article introduces the mica-auto open‑source tool that uses Java annotation processing to automatically generate Spring Boot configuration files like spring.factories and AutoConfiguration.imports, and provides step‑by‑step instructions for integrating it into a Maven project.

Programmer DD
Programmer DD
Programmer DD
Effortlessly Manage Spring Boot Config Files with mica-auto

After Spring Boot 2.7 stopped recommending the use of spring.factories, many developers find maintaining multiple configuration files cumbersome.

Open source project: mica-auto

mica-auto is an annotation‑processor‑based library that automatically generates Spring Boot configuration files such as spring.factories, spring-devtools.properties, and, from version 2.3 onward,

org.springframework.boot.autoconfigure.AutoConfiguration.imports

.

GitHub address: https://github.com/lets-mica/mica-auto

How to use mica-auto

Step 1: Add the dependency to pom.xml (use provided scope and place it after Lombok if Lombok is present).

<dependency>
  <groupId>net.dreamlu</groupId>
  <artifactId>mica-auto</artifactId>
  <version>2.3.0</version>
  <scope>provided</scope>
</dependency>

Step 2: Replace old configuration annotations with the newer ones, e.g., use @AutoConfiguration instead of @Configuration, so that the processor generates AutoConfiguration.imports rather than the legacy spring.factories.

@AutoConfiguration
@EnableConfigurationProperties(SwaggerProperties.class)
@ConditionalOnProperty(value = "springfox.documentation.enabled", havingValue = "true", matchIfMissing = true)
@Import({SwaggerUiConfiguration.class, SwaggerAuthorizationConfiguration.class, DocketConfiguration.class})
public class SwaggerAutoConfiguration {
    @Bean
    public DocketBeanFactoryPostProcessor docketBeanFactoryPostProcessor() {
        return new DocketBeanFactoryPostProcessor();
    }
}

After recompiling the project, the appropriate configuration files are generated automatically.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

JavaSpring BootAnnotation Processorautoconfigurationmica-auto
Programmer DD
Written by

Programmer DD

A tinkering programmer and author of "Spring Cloud Microservices in Action"

0 followers
Reader feedback

How this landed with the community

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.