Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Purpose of spring-boot-autoconfigure-processor?

Tags:

spring-boot

What is the purpose of:

annotationProcessor "org.springframework.boot:spring-boot-autoconfigure-processor"

My application is working fine with or without it. The thin jar that I create, is also working fine in dependent project.

I am asking this because that line is working fine when I include it in local build.gradle. But as soon I push it to cloud, I get this error:

Could not find method annotationProcessor() for arguments [org.springframework.boot:spring-boot-autoconfigure-processor] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

So I was thinking to do without it. I am not seeing any affect on the thin jar or the dependent project.

Also, This page says that I must use annotationProcessor in build.gradle when using Gradle 4.6 or above. What if I use compileOnly option in Gradle 4.8?

like image 249
Faraz Avatar asked Oct 20 '25 15:10

Faraz


1 Answers

spring-boot-autoconfigure-processor is an annotation processor that generates the file META-INF/spring-autoconfigure-metadata.properties for inclusion in your project's jar. This file helps with startup time, but is not necessary for your app to function correctly.

From the docs:

If that file is present, it is used to eagerly filter auto-configurations that do not match, which will improve startup time.

like image 134
Chris H. Avatar answered Oct 25 '25 13:10

Chris H.



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!