spring-projects / spring-projects/spring-boot

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

Open
#46,601 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status: pending-design-work type: enhancement
Dominant language
Java
Stars
81.5k
Forks
42.7k
Avg merge
2d 4h
Merged PRs (30d)
65

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing how ConfigurationPropertiesSource is handled when generating configuration-property documentation, using org.springframework.boot.http.client.autoconfigure.reactive.AbstractClientHttpConnectorProperties as a concrete example. Check how the nested Inner type is discovered when only the parent is annotated. Done means inherited nested properties are documented without requiring a separate annotation on the nested type.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
documentation
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.