Faraz
Faraz

Reputation: 6275

Purpose of spring-boot-autoconfigure-processor?

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?

Upvotes: 4

Views: 3399

Answers (1)

Chris H.
Chris H.

Reputation: 2273

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.

Upvotes: 8

Related Questions