46
46
import org .springframework .context .ApplicationContext ;
47
47
import org .springframework .context .ApplicationContextAware ;
48
48
import org .springframework .context .EnvironmentAware ;
49
+ import org .springframework .core .annotation .SynthesizedAnnotation ;
49
50
import org .springframework .core .env .Environment ;
50
51
51
52
import static org .assertj .core .api .Assertions .assertThat ;
@@ -86,8 +87,10 @@ void processManuallyRegisteredSingleton() {
86
87
@ Test
87
88
void registerConfigurationPropertiesAnnotation () {
88
89
RuntimeHints runtimeHints = process (SampleProperties .class );
89
- assertThat (runtimeHints .reflection ().getTypeHint (ConfigurationProperties .class )).satisfies (
90
- (hint ) -> assertThat (hint .getMemberCategories ()).contains (MemberCategory .INVOKE_DECLARED_METHODS ));
90
+ assertThat (runtimeHints .proxies ().jdkProxies ()).singleElement ()
91
+ .satisfies ((hint ) -> assertThat (hint .getProxiedInterfaces ()).containsExactly (
92
+ TypeReference .of (ConfigurationProperties .class ),
93
+ TypeReference .of (SynthesizedAnnotation .class )));
91
94
}
92
95
93
96
@ Test
@@ -111,7 +114,7 @@ void processJavaBeanConfigurationPropertiesWithMapOfPojo() {
111
114
List <TypeHint > typeHints = runtimeHints .reflection ().typeHints ().toList ();
112
115
assertThat (typeHints ).anySatisfy (javaBeanBinding (SamplePropertiesWithMap .class ));
113
116
assertThat (typeHints ).anySatisfy (javaBeanBinding (Address .class ));
114
- assertThat (typeHints ).hasSize (3 );
117
+ assertThat (typeHints ).hasSize (2 );
115
118
}
116
119
117
120
@ Test
@@ -120,7 +123,7 @@ void processJavaBeanConfigurationPropertiesWithListOfPojo() {
120
123
List <TypeHint > typeHints = runtimeHints .reflection ().typeHints ().toList ();
121
124
assertThat (typeHints ).anySatisfy (javaBeanBinding (SamplePropertiesWithList .class ));
122
125
assertThat (typeHints ).anySatisfy (javaBeanBinding (Address .class ));
123
- assertThat (typeHints ).hasSize (3 );
126
+ assertThat (typeHints ).hasSize (2 );
124
127
}
125
128
126
129
@ Test
@@ -129,15 +132,15 @@ void processJavaBeanConfigurationPropertiesWitArrayOfPojo() {
129
132
List <TypeHint > typeHints = runtimeHints .reflection ().typeHints ().toList ();
130
133
assertThat (typeHints ).anySatisfy (javaBeanBinding (SamplePropertiesWithArray .class ));
131
134
assertThat (typeHints ).anySatisfy (javaBeanBinding (Address .class ));
132
- assertThat (typeHints ).hasSize (3 );
135
+ assertThat (typeHints ).hasSize (2 );
133
136
}
134
137
135
138
@ Test
136
139
void processJavaBeanConfigurationPropertiesWithListOfJavaType () {
137
140
RuntimeHints runtimeHints = process (SamplePropertiesWithSimpleList .class );
138
141
List <TypeHint > typeHints = runtimeHints .reflection ().typeHints ().toList ();
139
142
assertThat (typeHints ).anySatisfy (javaBeanBinding (SamplePropertiesWithSimpleList .class ));
140
- assertThat (typeHints ).hasSize (2 );
143
+ assertThat (typeHints ).hasSize (1 );
141
144
}
142
145
143
146
@ Test
@@ -146,7 +149,7 @@ void processValueObjectConfigurationProperties() {
146
149
List <TypeHint > typeHints = runtimeHints .reflection ().typeHints ().toList ();
147
150
assertThat (typeHints ).anySatisfy (valueObjectBinding (SampleImmutableProperties .class ,
148
151
SampleImmutableProperties .class .getDeclaredConstructors ()[0 ]));
149
- assertThat (typeHints ).hasSize (2 );
152
+ assertThat (typeHints ).hasSize (1 );
150
153
}
151
154
152
155
@ Test
@@ -155,7 +158,7 @@ void processValueObjectConfigurationPropertiesWithSpecificConstructor() throws N
155
158
List <TypeHint > typeHints = runtimeHints .reflection ().typeHints ().toList ();
156
159
assertThat (typeHints ).anySatisfy (valueObjectBinding (SampleImmutablePropertiesWithSeveralConstructors .class ,
157
160
SampleImmutablePropertiesWithSeveralConstructors .class .getDeclaredConstructor (String .class )));
158
- assertThat (typeHints ).hasSize (2 );
161
+ assertThat (typeHints ).hasSize (1 );
159
162
}
160
163
161
164
@ Test
@@ -166,7 +169,7 @@ void processValueObjectConfigurationPropertiesWithSeveralLayersOfPojo() {
166
169
SampleImmutablePropertiesWithList .class .getDeclaredConstructors ()[0 ]));
167
170
assertThat (typeHints ).anySatisfy (valueObjectBinding (Person .class , Person .class .getDeclaredConstructors ()[0 ]));
168
171
assertThat (typeHints ).anySatisfy (valueObjectBinding (Address .class , Address .class .getDeclaredConstructors ()[0 ]));
169
- assertThat (typeHints ).hasSize (4 );
172
+ assertThat (typeHints ).hasSize (3 );
170
173
}
171
174
172
175
@ Test
@@ -182,15 +185,15 @@ void processConfigurationPropertiesWithNestedExternalType() {
182
185
assertThat (runtimeHints .reflection ().typeHints ())
183
186
.anySatisfy (javaBeanBinding (SamplePropertiesWithExternalNested .class ))
184
187
.anySatisfy (javaBeanBinding (SampleType .class )).anySatisfy (javaBeanBinding (SampleType .Nested .class ))
185
- .hasSize (4 );
188
+ .hasSize (3 );
186
189
}
187
190
188
191
@ Test
189
192
void processConfigurationPropertiesWithRecursiveType () {
190
193
RuntimeHints runtimeHints = process (SamplePropertiesWithRecursive .class );
191
194
assertThat (runtimeHints .reflection ().typeHints ())
192
195
.anySatisfy (javaBeanBinding (SamplePropertiesWithRecursive .class ))
193
- .anySatisfy (javaBeanBinding (Recursive .class )).hasSize (3 );
196
+ .anySatisfy (javaBeanBinding (Recursive .class )).hasSize (2 );
194
197
}
195
198
196
199
@ Test
@@ -201,16 +204,14 @@ void processValueObjectConfigurationPropertiesWithRecursiveType() {
201
204
SampleImmutablePropertiesWithRecursive .class .getDeclaredConstructors ()[0 ]))
202
205
.anySatisfy (valueObjectBinding (ImmutableRecursive .class ,
203
206
ImmutableRecursive .class .getDeclaredConstructors ()[0 ]))
204
- .hasSize (3 );
207
+ .hasSize (2 );
205
208
}
206
209
207
210
@ Test
208
211
void processConfigurationPropertiesWithWellKnownTypes () {
209
212
RuntimeHints runtimeHints = process (SamplePropertiesWithWellKnownTypes .class );
210
213
assertThat (runtimeHints .reflection ().typeHints ())
211
- .anySatisfy (javaBeanBinding (SamplePropertiesWithWellKnownTypes .class ))
212
- // TODO
213
- .hasSize (2 );
214
+ .anySatisfy (javaBeanBinding (SamplePropertiesWithWellKnownTypes .class )).hasSize (1 );
214
215
}
215
216
216
217
@ Test
@@ -219,7 +220,7 @@ void processConfigurationPropertiesWithCrossReference() {
219
220
assertThat (runtimeHints .reflection ().typeHints ())
220
221
.anySatisfy (javaBeanBinding (SamplePropertiesWithCrossReference .class ))
221
222
.anySatisfy (javaBeanBinding (CrossReferenceA .class )).anySatisfy (javaBeanBinding (CrossReferenceB .class ))
222
- .hasSize (4 );
223
+ .hasSize (3 );
223
224
}
224
225
225
226
@ Test
0 commit comments