@ -186,6 +186,14 @@ public class BeanRegistryAdapterTests {
@@ -186,6 +186,14 @@ public class BeanRegistryAdapterTests {
assertThat ( beanDefinition . getScope ( ) ) . isEqualTo ( AbstractBeanDefinition . SCOPE_PROTOTYPE ) ;
}
@Test
void customScope ( ) {
BeanRegistryAdapter adapter = new BeanRegistryAdapter ( this . beanFactory , this . beanFactory , this . env , ScopeBeanRegistrar . class ) ;
new ScopeBeanRegistrar ( ) . register ( adapter , env ) ;
BeanDefinition beanDefinition = this . beanFactory . getBeanDefinition ( "foo" ) ;
assertThat ( beanDefinition . getScope ( ) ) . isEqualTo ( "custom" ) ;
}
@Test
void defaultSupplier ( ) {
BeanRegistryAdapter adapter = new BeanRegistryAdapter ( this . beanFactory , this . beanFactory , this . env , DefaultBeanRegistrar . class ) ;
@ -308,6 +316,14 @@ public class BeanRegistryAdapterTests {
@@ -308,6 +316,14 @@ public class BeanRegistryAdapterTests {
}
}
private static class ScopeBeanRegistrar implements BeanRegistrar {
@Override
public void register ( BeanRegistry registry , Environment env ) {
registry . registerBean ( "foo" , Foo . class , spec - > spec . scope ( "custom" ) ) ;
}
}
private static class SupplierBeanRegistrar implements BeanRegistrar {
@Override