Hi,
i have the following configuration class:
@ConfigurationProperties(prefix = "application")
@ConstructorBinding
@Value
class FooConfigurationProperties {
/**
* URL of the endpoint.
*/
@NonNull
URI endpoint;
}
I have included the spring-boot-configuration-processor in maven:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
i also have lombok in my project:
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<scope>provided</scope>
</dependency>
When building the project, i get a META-INF/spring-configuration-metadata.json
generated, but only the "groups": [
section is filled, not the "properties": [
, it's an empty array. The autocompletion in IntelliJ doesn't work.
When rewriting the config class to:
@ConfigurationProperties(prefix = "application")
@Data
@NoArgsConstructor(access = AccessLevel.PRIVATE)
@AllArgsConstructor
class FooConfigurationProperties {
/**
* URL of the endpoint.
*/
@NonNull
private String endpoint;
}
everything works as expected.
Spring Boot Version: 2.3.3
Comment From: phxql
If i switch the order of lombok and the spring processor around (lombok before spring), then i get this json:
"properties": [
{
"name": "application.arg0",
"type": "java.net.URI",
"sourceType": "path.to.package.FooConfigurationProperties"
},
arg0
doesn't seem right.
i have enabled parameters in the compiler plugin via
<properties>
<maven.compiler.parameters>true</maven.compiler.parameters>
</properties>
Comment From: wilkinsona
The ordering of the processors is important, otherwise our annotation processor cannot see the changes made by Spring. The arg0
name is due to a limitation of Lombok. Please see https://github.com/spring-projects/spring-boot/issues/18730 for more details.