DATACMNS-1238 - Optimize setting Environment on ClassPathScanningCandidateComponentProvider.
In CustomRepositoryImplementationDetector, we now immediately hand the Environment to the constructor of ClassPathScanningCandidateComponentProvider instead of setting it afterwards. This prevents a default StandardEnvironment from being created in the previously used constructor.
This commit is contained in:
@@ -102,8 +102,8 @@ public class CustomRepositoryImplementationDetector {
|
||||
Pattern pattern = Pattern.compile(".*\\." + className);
|
||||
|
||||
// Build classpath scanner and lookup bean definition
|
||||
ClassPathScanningCandidateComponentProvider provider = new ClassPathScanningCandidateComponentProvider(false);
|
||||
provider.setEnvironment(environment);
|
||||
ClassPathScanningCandidateComponentProvider provider = new ClassPathScanningCandidateComponentProvider(false,
|
||||
environment);
|
||||
provider.setResourceLoader(resourceLoader);
|
||||
provider.setResourcePattern(String.format(CUSTOM_IMPLEMENTATION_RESOURCE_PATTERN, className));
|
||||
provider.setMetadataReaderFactory(metadataReaderFactory);
|
||||
|
||||
Reference in New Issue
Block a user