private BeanDefinitionRegistry getBeanDefinitionRegistry ( ApplicationContext context ) { if ( context instanceof BeanDefinitionRegistry ) { return ( BeanDefinitionRegistry ) context ; } if ( context instanceof AbstractApplicationContext ) { return ( BeanDefinitionRegistry ) ( ( AbstractApplicationContext ) context ) . getBeanFactory ( ) ; } throw new IllegalStateException ( "Could not locate BeanDefinitionRegistry" ) ; }
Get the bean definition registry .