Skip to content

Automatically expose a nested type if the parent is annotated with ConfigurationPropertiesSource #46601

@snicoll

Description

@snicoll

Here's a simple use case:

@ConfigurationPropertiesSource
public class BaseType {

	/**
	 * Name to use.
	 */
	private String name = "test";

	private final Inner inner = new Inner();

	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Inner getInner() {
		return this.inner;
	}

	public static class Inner {

		/**
		 * Some smart description
		 */
		private int counter = 42;

		public int getCounter() {
			return this.counter;
		}

		public void setCounter(int counter) {
			this.counter = counter;
		}
	}
}

If we extend in another module from BaseType, something like

@ConfigurationProperties("example")
public class ExampleType extends BaseType { ...}

Then the inner properties are not documented. To make this work, we need to annotate Inner with @ConfigurationPropertiesSource as well. That's a bit confusing as we do this automatically for configuration properties.

When fixing this, there are a number of classes that should be updated, for instance org.springframework.boot.http.client.autoconfigure.reactive.AbstractClientHttpConnectorProperties.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions