@@ -338,6 +338,7 @@ private void processImport(ConfigurationClass configClass, String[] classesToImp
338
338
try {
339
339
ImportSelector selector = BeanUtils .instantiateClass (
340
340
this .resourceLoader .getClassLoader ().loadClass (candidate ), ImportSelector .class );
341
+ invokeAwareMethods (selector );
341
342
processImport (configClass , selector .selectImports (importingClassMetadata ), false );
342
343
}
343
344
catch (ClassNotFoundException ex ) {
@@ -369,21 +370,21 @@ else if (reader.match(ImportBeanDefinitionRegistrar.class)) {
369
370
370
371
/**
371
372
* Invoke {@link ResourceLoaderAware}, {@link BeanClassLoaderAware} and
372
- * {@link BeanFactoryAware} contracts if implemented by the given {@code registrar }.
373
+ * {@link BeanFactoryAware} contracts if implemented by the given {@code bean }.
373
374
*/
374
- private void invokeAwareMethods (ImportBeanDefinitionRegistrar registrar ) {
375
- if (registrar instanceof Aware ) {
376
- if (registrar instanceof ResourceLoaderAware ) {
377
- ((ResourceLoaderAware ) registrar ).setResourceLoader (this .resourceLoader );
375
+ private void invokeAwareMethods (Object importStrategyBean ) {
376
+ if (importStrategyBean instanceof Aware ) {
377
+ if (importStrategyBean instanceof ResourceLoaderAware ) {
378
+ ((ResourceLoaderAware ) importStrategyBean ).setResourceLoader (this .resourceLoader );
378
379
}
379
- if (registrar instanceof BeanClassLoaderAware ) {
380
+ if (importStrategyBean instanceof BeanClassLoaderAware ) {
380
381
ClassLoader classLoader = (this .registry instanceof ConfigurableBeanFactory ?
381
382
((ConfigurableBeanFactory ) this .registry ).getBeanClassLoader () :
382
383
this .resourceLoader .getClassLoader ());
383
- ((BeanClassLoaderAware ) registrar ).setBeanClassLoader (classLoader );
384
+ ((BeanClassLoaderAware ) importStrategyBean ).setBeanClassLoader (classLoader );
384
385
}
385
- if (registrar instanceof BeanFactoryAware && this .registry instanceof BeanFactory ) {
386
- ((BeanFactoryAware ) registrar ).setBeanFactory ((BeanFactory ) this .registry );
386
+ if (importStrategyBean instanceof BeanFactoryAware && this .registry instanceof BeanFactory ) {
387
+ ((BeanFactoryAware ) importStrategyBean ).setBeanFactory ((BeanFactory ) this .registry );
387
388
}
388
389
}
389
390
}
0 commit comments