|
24 | 24 | import org.springframework.beans.factory.support.BeanNameGenerator;
|
25 | 25 | import org.springframework.context.EnvironmentAware;
|
26 | 26 | import org.springframework.context.ResourceLoaderAware;
|
| 27 | +import org.springframework.context.annotation.ConfigurationClassPostProcessor; |
27 | 28 | import org.springframework.context.annotation.ImportBeanDefinitionRegistrar;
|
28 | 29 | import org.springframework.core.env.Environment;
|
29 | 30 | import org.springframework.core.io.ResourceLoader;
|
@@ -59,25 +60,43 @@ public void setEnvironment(Environment environment) {
|
59 | 60 | this.environment = environment;
|
60 | 61 | }
|
61 | 62 |
|
| 63 | + /** |
| 64 | + * Forwarding to {@link #registerBeanDefinitions(AnnotationMetadata, BeanDefinitionRegistry, BeanNameGenerator)} for |
| 65 | + * backwards compatibility reasons so that tests in downstream modules do not accidentally invoke the super type's |
| 66 | + * default implementation. |
| 67 | + * |
| 68 | + * @see org.springframework.context.annotation.ImportBeanDefinitionRegistrar#registerBeanDefinitions(org.springframework.core.type.AnnotationMetadata, |
| 69 | + * org.springframework.beans.factory.support.BeanDefinitionRegistry) |
| 70 | + * @deprecated since 2.2, call |
| 71 | + * {@link #registerBeanDefinitions(AnnotationMetadata, BeanDefinitionRegistry, BeanNameGenerator)} |
| 72 | + * instead. |
| 73 | + * @see ConfigurationClassPostProcessor#IMPORT_BEAN_NAME_GENERATOR |
| 74 | + */ |
| 75 | + @Override |
| 76 | + @Deprecated |
| 77 | + public void registerBeanDefinitions(AnnotationMetadata metadata, BeanDefinitionRegistry registry) { |
| 78 | + registerBeanDefinitions(metadata, registry, ConfigurationClassPostProcessor.IMPORT_BEAN_NAME_GENERATOR); |
| 79 | + } |
| 80 | + |
62 | 81 | /*
|
63 | 82 | * (non-Javadoc)
|
64 | 83 | * @see org.springframework.context.annotation.ImportBeanDefinitionRegistrar#registerBeanDefinitions(org.springframework.core.type.AnnotationMetadata, org.springframework.beans.factory.support.BeanDefinitionRegistry, org.springframework.beans.factory.support.BeanNameGenerator)
|
65 | 84 | */
|
66 | 85 | @Override
|
67 |
| - public void registerBeanDefinitions(AnnotationMetadata annotationMetadata, BeanDefinitionRegistry registry, |
| 86 | + public void registerBeanDefinitions(AnnotationMetadata metadata, BeanDefinitionRegistry registry, |
68 | 87 | BeanNameGenerator generator) {
|
69 | 88 |
|
70 |
| - Assert.notNull(annotationMetadata, "AnnotationMetadata must not be null!"); |
| 89 | + Assert.notNull(metadata, "AnnotationMetadata must not be null!"); |
71 | 90 | Assert.notNull(registry, "BeanDefinitionRegistry must not be null!");
|
72 | 91 | Assert.notNull(resourceLoader, "ResourceLoader must not be null!");
|
73 | 92 |
|
74 | 93 | // Guard against calls for sub-classes
|
75 |
| - if (annotationMetadata.getAnnotationAttributes(getAnnotation().getName()) == null) { |
| 94 | + if (metadata.getAnnotationAttributes(getAnnotation().getName()) == null) { |
76 | 95 | return;
|
77 | 96 | }
|
78 | 97 |
|
79 |
| - AnnotationRepositoryConfigurationSource configurationSource = new AnnotationRepositoryConfigurationSource( |
80 |
| - annotationMetadata, getAnnotation(), resourceLoader, environment, registry, generator); |
| 98 | + AnnotationRepositoryConfigurationSource configurationSource = new AnnotationRepositoryConfigurationSource(metadata, |
| 99 | + getAnnotation(), resourceLoader, environment, registry, generator); |
81 | 100 |
|
82 | 101 | RepositoryConfigurationExtension extension = getExtension();
|
83 | 102 | RepositoryConfigurationUtils.exposeRegistration(extension, registry, configurationSource);
|
|
0 commit comments