You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Rename `@ConfigurationPropertiesImport` to
`@ImportAsConfigurationPropertiesBean` and also refine the registrar
so that it can be used with type directly annotated with
`@ConfigurationProperties`.
Closesgh-23172
Copy file name to clipboardExpand all lines: spring-boot-project/spring-boot-docs/src/docs/asciidoc/spring-boot-features.adoc
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1227,7 +1227,7 @@ Spring Boot provides infrastructure to bind `@ConfigurationProperties` types and
1227
1227
You can either enable configuration properties on a class-by-class basis or enable configuration property scanning that works in a similar manner to component scanning.
1228
1228
1229
1229
Sometimes, classes annotated with `@ConfigurationProperties` might not be suitable for scanning, for example, if you're developing your own auto-configuration or you want to enable them conditionally.
1230
-
In these cases, specify the list of types to process using the `@EnableConfigurationProperties` or `@ConfigurationPropertiesImport` annotations.
1230
+
In these cases, specify the list of types to process using the `@EnableConfigurationProperties` or `@ImportAsConfigurationPropertiesBean` annotations.
1231
1231
This can be done on any `@Configuration` class, as shown in the following example:
1232
1232
1233
1233
[source,java,indent=0]
@@ -1253,7 +1253,7 @@ If you want to define specific packages to scan, you can do so as shown in the f
1253
1253
1254
1254
[NOTE]
1255
1255
====
1256
-
When the `@ConfigurationProperties` bean is registered using configuration property scanning or via `@EnableConfigurationProperties` or `@ConfigurationPropertiesImport`, the bean has a conventional name: `<prefix>-<fqn>`, where `<prefix>` is the environment key prefix specified in the `@ConfigurationProperties` annotation and `<fqn>` is the fully qualified name of the bean.
1256
+
When the `@ConfigurationProperties` bean is registered using configuration property scanning or via `@EnableConfigurationProperties` or `@ImportAsConfigurationPropertiesBean`, the bean has a conventional name: `<prefix>-<fqn>`, where `<prefix>` is the environment key prefix specified in the `@ConfigurationProperties` annotation and `<fqn>` is the fully qualified name of the bean.
1257
1257
If the annotation does not provide any prefix, only the fully qualified name of the bean is used.
1258
1258
1259
1259
The bean name in the example above is `acme-com.example.AcmeProperties`.
@@ -1333,18 +1333,18 @@ To configure a bean from the `Environment` properties, add `@ConfigurationProper
1333
1333
Any JavaBean property defined with the `another` prefix is mapped onto that `ExampleItem` bean in manner similar to the preceding `AcmeProperties` example.
1334
1334
1335
1335
If you want to use constructor binding with a third-party class, you can't use a `@Bean` method since Spring will need to create the object instance.
1336
-
For those situations, you can use an `@ConfigurationPropertiesImport` annotation on your `@Configuration` or `@SpringBootApplication` class.
1336
+
For those situations, you can use an `@ImportAsConfigurationPropertiesBean` annotation on your `@Configuration` or `@SpringBootApplication` class.
Copy file name to clipboardExpand all lines: spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/ConfigurationMetadataAnnotationProcessor.java
+38-28Lines changed: 38 additions & 28 deletions
Original file line number
Diff line number
Diff line change
@@ -80,9 +80,9 @@ public class ConfigurationMetadataAnnotationProcessor extends AbstractProcessor
Copy file name to clipboardExpand all lines: spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/MetadataGenerationEnvironment.java
+13-13Lines changed: 13 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -97,15 +97,15 @@ class MetadataGenerationEnvironment {
Copy file name to clipboardExpand all lines: spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/PropertyDescriptorResolver.java
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -50,7 +50,7 @@ class PropertyDescriptorResolver {
50
50
* factory method}, if any.
51
51
* @param type the target type
52
52
* @param fromImport it the type was imported via a
53
-
* {@code @ConfigurationPropertiesImport}
53
+
* {@code @ImportAsConfigurationPropertiesBean}
54
54
* @param factoryMethod the method that triggered the metadata for that {@code type}
55
55
* or {@code null}
56
56
* @return the candidate properties for metadata generation
Copy file name to clipboardExpand all lines: spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/ImportBeanTests.java
Copy file name to clipboardExpand all lines: spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/MetadataGenerationEnvironmentFactory.java
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -40,8 +40,8 @@ public MetadataGenerationEnvironment apply(ProcessingEnvironment environment) {
Copy file name to clipboardExpand all lines: spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/test/TestConfigurationMetadataAnnotationProcessor.java
+6-6Lines changed: 6 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -57,9 +57,9 @@ public class TestConfigurationMetadataAnnotationProcessor extends ConfigurationM
Copy file name to clipboardExpand all lines: spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationsample/ImportAsConfigurationPropertiesBean.java
Copy file name to clipboardExpand all lines: spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationsample/ImportAsConfigurationPropertiesBeans.java
+3-3Lines changed: 3 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -23,16 +23,16 @@
23
23
importjava.lang.annotation.Target;
24
24
25
25
/**
26
-
* Alternative to Spring Boot's {@code ConfigurationPropertiesImports} for testing
26
+
* Alternative to Spring Boot's {@code ImportAsConfigurationPropertiesBeans} for testing
27
27
* (removes the need for a dependency on the real annotation).
28
28
*
29
29
* @author Phillip Webb
30
30
*/
31
31
@Target(ElementType.TYPE)
32
32
@Retention(RetentionPolicy.RUNTIME)
33
33
@Documented
34
-
public @interface ConfigurationPropertiesImports {
34
+
public @interface ImportAsConfigurationPropertiesBeans {
0 commit comments