Skip to content

@DeprecatedConfigurationProperty has no effect when declared on a record component's accessor method #29526

Closed
@wilkinsona

Description

@wilkinsona

@DeprecatedConfigurationProperty must be used on the getter of the deprecated element. For a record, that looks like this:

@ConstructorBinding
@ConfigurationProperties("example")
public record Example(String alpha, String bravo) {

	@Deprecated
	@DeprecatedConfigurationProperty
	public String alpha() {
		return this.alpha;
	}

}

This does not work as the deprecation is not captured in the metadata:

{
  "groups": [
    {
      "name": "example",
      "type": "com.example.demo.Example",
      "sourceType": "com.example.demo.Example"
    }
  ],
  "properties": [
    {
      "name": "example.alpha",
      "type": "java.lang.String",
      "sourceType": "com.example.demo.Example"
    },
    {
      "name": "example.bravo",
      "type": "java.lang.String",
      "sourceType": "com.example.demo.Example"
    }
  ],
  "hints": []
}

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions