DATACMNS-494 - Removed the defaulting of the environment in RepositoryBeanDefinitionRegistrarSupport.
As SPR-11744 got fixed recently and will be available in Spring 3.2.9, we removed the guard in RepositoryBeanDefinitionRegistrarSupport which defaulted the environment in case it was not set by the container. Related tickets: SPR-11744.
This commit is contained in:
@@ -23,8 +23,6 @@ import org.springframework.context.EnvironmentAware;
|
||||
import org.springframework.context.ResourceLoaderAware;
|
||||
import org.springframework.context.annotation.ImportBeanDefinitionRegistrar;
|
||||
import org.springframework.core.env.Environment;
|
||||
import org.springframework.core.env.EnvironmentCapable;
|
||||
import org.springframework.core.env.StandardEnvironment;
|
||||
import org.springframework.core.io.ResourceLoader;
|
||||
import org.springframework.core.type.AnnotationMetadata;
|
||||
import org.springframework.util.Assert;
|
||||
@@ -73,9 +71,6 @@ public abstract class RepositoryBeanDefinitionRegistrarSupport implements Import
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO: remove once SPR-11744 gets fixed
|
||||
Environment environment = defaultEnvironment(this.environment, resourceLoader);
|
||||
|
||||
AnnotationRepositoryConfigurationSource configurationSource = new AnnotationRepositoryConfigurationSource(
|
||||
annotationMetadata, getAnnotation(), resourceLoader, environment);
|
||||
|
||||
@@ -84,23 +79,6 @@ public abstract class RepositoryBeanDefinitionRegistrarSupport implements Import
|
||||
delegate.registerRepositoriesIn(registry, getExtension());
|
||||
}
|
||||
|
||||
/**
|
||||
* Defaults the environment in case the given one is null. TODO: remove, once SPR-11744 gets fixed.
|
||||
*
|
||||
* @param environment
|
||||
* @param resourceLoader
|
||||
* @return
|
||||
*/
|
||||
private static Environment defaultEnvironment(Environment environment, ResourceLoader resourceLoader) {
|
||||
|
||||
if (environment != null) {
|
||||
return environment;
|
||||
}
|
||||
|
||||
return resourceLoader instanceof EnvironmentCapable ? ((EnvironmentCapable) resourceLoader).getEnvironment()
|
||||
: new StandardEnvironment();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the annotation to obtain configuration information from. Will be wrappen into an
|
||||
* {@link AnnotationRepositoryConfigurationSource} so have a look at the constants in there for what annotation
|
||||
|
||||
Reference in New Issue
Block a user