@@ -14,6 +14,7 @@ import io.micronaut.context.visitor.ConfigurationReaderVisitor
14
14
import io.micronaut.core.annotation.Introspected
15
15
import io.micronaut.core.annotation.NextMajorVersion
16
16
import io.micronaut.core.annotation.NonNull
17
+ import io.micronaut.core.annotation.Nullable
17
18
import io.micronaut.core.beans.BeanIntrospection
18
19
import io.micronaut.core.beans.BeanIntrospectionReference
19
20
import io.micronaut.core.beans.BeanIntrospector
@@ -2596,6 +2597,52 @@ public class ValidatedConfig {
2596
2597
introspection. getIndexedProperties(Constraint . class). size() == 2
2597
2598
}
2598
2599
2600
+ void " not found indexed properties" () {
2601
+ BeanIntrospection introspection = buildBeanIntrospection(' test.ValidatedConfig' ,''' \
2602
+ package test;
2603
+
2604
+ import io.micronaut.context.annotation.ConfigurationProperties;
2605
+
2606
+ import jakarta.validation.constraints.NotNull;
2607
+ import jakarta.validation.constraints.NotBlank;
2608
+ import java.net.URL;
2609
+
2610
+ @ConfigurationProperties("foo.bar")
2611
+ public class ValidatedConfig {
2612
+
2613
+ @NotNull
2614
+ URL url;
2615
+
2616
+ @NotBlank
2617
+ protected String name;
2618
+
2619
+ public URL getUrl() {
2620
+ return url;
2621
+ }
2622
+
2623
+ public void setUrl(URL url) {
2624
+ this.url = url;
2625
+ }
2626
+
2627
+ public String getName() {
2628
+ return name;
2629
+ }
2630
+
2631
+ public void setName(String name) {
2632
+ this.name = name;
2633
+ }
2634
+ }
2635
+
2636
+
2637
+ ''' )
2638
+ expect :
2639
+ introspection != null
2640
+ ! introspection. getIndexedProperties(Constraint . class). isEmpty()
2641
+ introspection. getIndexedProperties(Constraint . class). size() == 2
2642
+ introspection. getIndexedProperty(Nullable . class). isEmpty()
2643
+ introspection. getIndexedProperties(Nullable . class). isEmpty()
2644
+ }
2645
+
2599
2646
void " test generate bean introspection for @ConfigurationProperties with validation rules on fields and custom getter" () {
2600
2647
BeanIntrospection introspection = buildBeanIntrospection(' test.ValidatedConfig' , ''' \
2601
2648
package test;
0 commit comments