Correct docs for use of static with @ConfigurationPropertiesBinding
Build and Deploy Snapshot / Build and Deploy Snapshot (push) Waiting to run Details
Build and Deploy Snapshot / Trigger Docs Build (push) Blocked by required conditions Details
Build and Deploy Snapshot / Verify (push) Blocked by required conditions Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:false version:17], map[id:${{ vars.UBUNTU_MEDIUM || 'ubuntu-latest' }} name:Linux]) (push) Waiting to run Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:false version:17], map[id:windows-latest name:Windows]) (push) Waiting to run Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:true version:21], map[id:${{ vars.UBUNTU_MEDIUM || 'ubuntu-latest' }} name:Linux]) (push) Waiting to run Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:true version:21], map[id:windows-latest name:Windows]) (push) Waiting to run Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:true version:22], map[id:${{ vars.UBUNTU_MEDIUM || 'ubuntu-latest' }} name:Linux]) (push) Waiting to run Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:true version:22], map[id:windows-latest name:Windows]) (push) Waiting to run Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:true version:23], map[id:${{ vars.UBUNTU_MEDIUM || 'ubuntu-latest' }} name:Linux]) (push) Waiting to run Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:true version:23], map[id:windows-latest name:Windows]) (push) Waiting to run Details
Run System Tests / Java ${{ matrix.java.version}} (map[toolchain:false version:17]) (push) Waiting to run Details
Run System Tests / Java ${{ matrix.java.version}} (map[toolchain:true version:21]) (push) Waiting to run Details

Closes gh-45621
This commit is contained in:
Andy Wilkinson 2025-05-21 08:39:10 +01:00
parent 6b8ab75ae4
commit bdf0ef19a4
3 changed files with 7 additions and 7 deletions

View File

@ -1141,11 +1141,10 @@ If you need custom type conversion, you can provide a javadoc:org.springframewor
==== ====
Beans used for property conversion are requested very early during the application lifecycle so make sure to limit the dependencies that your javadoc:org.springframework.core.convert.ConversionService[] is using. Beans used for property conversion are requested very early during the application lifecycle so make sure to limit the dependencies that your javadoc:org.springframework.core.convert.ConversionService[] is using.
Typically, any dependency that you require may not be fully initialized at creation time. Typically, any dependency that you require may not be fully initialized at creation time.
You should also declare any javadoc:org.springframework.boot.context.properties.ConfigurationProperties[format=annotation] beans using `static` methods to avoid "`bean is not eligible for getting processed by all BeanPostProcessors`" warnings.
==== ====
TIP: You may want to rename your custom javadoc:org.springframework.core.convert.ConversionService[] if it is not required for configuration keys coercion and only rely on custom converters qualified with javadoc:org.springframework.boot.context.properties.ConfigurationPropertiesBinding[format=annotation]. TIP: You may want to rename your custom javadoc:org.springframework.core.convert.ConversionService[] if it is not required for configuration keys coercion and only rely on custom converters qualified with javadoc:org.springframework.boot.context.properties.ConfigurationPropertiesBinding[format=annotation].
When qualifying a `@Bean` method with `@ConfigurationPropertiesBinding`, the method should be `static` to avoid "`bean is not eligible for getting processed by all BeanPostProcessors`" warnings.

View File

@ -37,10 +37,6 @@ import org.springframework.stereotype.Indexed;
* <p> * <p>
* Note that contrary to {@code @Value}, SpEL expressions are not evaluated since property * Note that contrary to {@code @Value}, SpEL expressions are not evaluated since property
* values are externalized. * values are externalized.
* <p>
* Static methods should be used when declaring {@code @ConfigurationProperties} beans to
* ensure that "bean is not eligible for getting processed by all BeanPostProcessors"
* warnings are not produced.
* *
* @author Dave Syer * @author Dave Syer
* @since 1.0.0 * @since 1.0.0

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2019 the original author or authors. * Copyright 2012-2025 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -23,10 +23,15 @@ import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target; import java.lang.annotation.Target;
import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
/** /**
* Qualifier for beans that are needed to configure the binding of * Qualifier for beans that are needed to configure the binding of
* {@link ConfigurationProperties @ConfigurationProperties} (e.g. Converters). * {@link ConfigurationProperties @ConfigurationProperties} (e.g. Converters).
* <p>
* {@link Bean @Bean} methods that declare a {@code @ConfigurationPropertiesBinding} bean
* should be {@code static} to ensure that "bean is not eligible for getting processed by
* all BeanPostProcessors" warnings are not produced.
* *
* @author Dave Syer * @author Dave Syer
* @since 1.3.0 * @since 1.3.0