Skip to content

Configuration property descriptions may be lost when building incrementally #28075

Open
@wilkinsona

Description

@wilkinsona

We have two @ConfigurationProperties annotated classes:

package com.example;

import org.springframework.boot.context.properties.ConfigurationProperties;

@ConfigurationProperties(prefix = "more")
public class MoreProperties {
	
	/**
	 * Another example property.
	 */
	private String someProperty;

	public void setSomeProperty(String someProperty) {
		this.someProperty = someProperty;
	}

	public String getSomeProperty() {
		return this.someProperty;
	}

}
package com.example;

import org.springframework.boot.context.properties.ConfigurationProperties;

@ConfigurationProperties(prefix = "some")
public class SomeProperties {
	
	/**
	 * An example property.
	 */
	private String someProperty;

	public void setSomeProperty(String someProperty) {
		this.someProperty = someProperty;
	}

	public String getSomeProperty() {
		return this.someProperty;
	}

}

compileJava produces the following metadata:

{
  "groups": [
    {
      "name": "more",
      "type": "com.example.MoreProperties",
      "sourceType": "com.example.MoreProperties"
    },
    {
      "name": "some",
      "type": "com.example.SomeProperties",
      "sourceType": "com.example.SomeProperties"
    }
  ],
  "properties": [
    {
      "name": "more.some-property",
      "type": "java.lang.String",
      "description": "Another example property.",
      "sourceType": "com.example.MoreProperties"
    },
    {
      "name": "some.some-property",
      "type": "java.lang.String",
      "description": "An example property.",
      "sourceType": "com.example.SomeProperties"
    }
  ],
  "hints": []
}

We then change the description of more.some-property to Another example property with a new description.. compileJava now produces the following metadata:

{
  "groups": [
    {
      "name": "more",
      "type": "com.example.MoreProperties",
      "sourceType": "com.example.MoreProperties"
    },
    {
      "name": "some",
      "type": "com.example.SomeProperties",
      "sourceType": "com.example.SomeProperties"
    }
  ],
  "properties": [
    {
      "name": "more.some-property",
      "type": "java.lang.String",
      "description": "Another example property with a new description.",
      "sourceType": "com.example.MoreProperties"
    },
    {
      "name": "some.some-property",
      "type": "java.lang.String",
      "sourceType": "com.example.SomeProperties"
    }
  ],
  "hints": []
}

The description of the property that was not changed, some.some-property, has been lost. Upon running clean compileJava it reappears.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions