@@ -263,6 +263,32 @@ void nonInitializedFactoryBeanIgnoredByNonEagerTypeMatching() {
263
263
assertThat (DummyFactory .wasPrototypeCreated ()).as ("prototype not instantiated" ).isFalse ();
264
264
}
265
265
266
+ @ Test
267
+ void nonInitializedFactoryBeanIgnoredByEagerTypeMatching () {
268
+ RootBeanDefinition bd = new RootBeanDefinition (DummyFactory .class );
269
+ bd .setAttribute (FactoryBean .OBJECT_TYPE_ATTRIBUTE , String .class );
270
+ lbf .registerBeanDefinition ("x1" , bd );
271
+
272
+ assertBeanNamesForType (TestBean .class , false , true );
273
+ assertThat (lbf .getBeanNamesForAnnotation (SuppressWarnings .class )).isEmpty ();
274
+
275
+ assertThat (lbf .containsSingleton ("x1" )).isFalse ();
276
+ assertThat (lbf .containsBean ("x1" )).isTrue ();
277
+ assertThat (lbf .containsBean ("&x1" )).isTrue ();
278
+ assertThat (lbf .isSingleton ("x1" )).isTrue ();
279
+ assertThat (lbf .isSingleton ("&x1" )).isTrue ();
280
+ assertThat (lbf .isPrototype ("x1" )).isFalse ();
281
+ assertThat (lbf .isPrototype ("&x1" )).isFalse ();
282
+ assertThat (lbf .isTypeMatch ("x1" , TestBean .class )).isTrue ();
283
+ assertThat (lbf .isTypeMatch ("&x1" , TestBean .class )).isFalse ();
284
+ assertThat (lbf .isTypeMatch ("&x1" , DummyFactory .class )).isTrue ();
285
+ assertThat (lbf .isTypeMatch ("&x1" , ResolvableType .forClass (DummyFactory .class ))).isTrue ();
286
+ assertThat (lbf .isTypeMatch ("&x1" , ResolvableType .forClassWithGenerics (FactoryBean .class , Object .class ))).isTrue ();
287
+ assertThat (lbf .isTypeMatch ("&x1" , ResolvableType .forClassWithGenerics (FactoryBean .class , String .class ))).isFalse ();
288
+ assertThat (lbf .getType ("x1" )).isEqualTo (TestBean .class );
289
+ assertThat (lbf .getType ("&x1" )).isEqualTo (DummyFactory .class );
290
+ }
291
+
266
292
@ Test
267
293
void initializedFactoryBeanFoundByNonEagerTypeMatching () {
268
294
Properties p = new Properties ();
0 commit comments