From 5984d4ee2b62f7a3af36b4d44c02000ae6234348 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Fri, 14 May 2021 13:41:24 +0100 Subject: [PATCH] Index @ConfigurationProperties so they can be found by scanning Previously, @ConfigurationProperties was not annotated with @Indexed. This meant that @ConfigurationPropertiesScan would not be able to find them when the underlying ClassPathScanningCandidateComponentProvider is using a CandidateComponentsIndex. This commit annotated @ConfigurationProperties with @Indexed so that they can be found by index-based scanning. Fixes gh-26459 --- .../boot/context/properties/ConfigurationProperties.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationProperties.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationProperties.java index 55d045fc998..86510c2b53a 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationProperties.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2019 the original author or authors. + * Copyright 2012-2021 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,6 +23,7 @@ import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import org.springframework.core.annotation.AliasFor; +import org.springframework.stereotype.Indexed; /** * Annotation for externalized configuration. Add this to a class definition or a @@ -46,6 +47,7 @@ import org.springframework.core.annotation.AliasFor; @Target({ ElementType.TYPE, ElementType.METHOD }) @Retention(RetentionPolicy.RUNTIME) @Documented +@Indexed public @interface ConfigurationProperties { /**