Source:
public BeanDefinitionBuilder build(RepositoryConfiguration<?> configuration) { Assert.notNull(registry, "BeanDefinitionRegistry must not be null!"); Assert.notNull(resourceLoader, "ResourceLoader must not be null!"); BeanDefinitionBuilder builder = BeanDefinitionBuilder .rootBeanDefinition(configuration.getRepositoryFactoryBeanClassName()); builder.getRawBeanDefinition().setSource(configuration.getSource()); builder.addConstructorArgValue(configuration.getRepositoryInterface()); builder.addPropertyValue("queryLookupStrategyKey", configuration.getQueryLookupStrategyKey()); builder.addPropertyValue("lazyInit", configuration.isLazyInit()); configuration.getRepositoryBaseClassName() .ifPresent(it -> builder.addPropertyValue("repositoryBaseClass", it)); NamedQueriesBeanDefinitionBuilder definitionBuilder = new NamedQueriesBeanDefinitionBuilder( extension.getDefaultNamedQueryLocation()); configuration.getNamedQueriesLocation().ifPresent(definitionBuilder::setLocations); builder.addPropertyValue("namedQueries", definitionBuilder.build(configuration.getSource())); registerCustomImplementation(configuration).ifPresent(it -> { builder.addPropertyReference("customImplementation", it); builder.addDependsOn(it); }); BeanDefinitionBuilder repositoryCompositionBuilder = BeanDefinitionBuilder .rootBeanDefinition(RepositoryCompositionFactoryBean.class); List<String> fragmentBeanNames = new ArrayList<>(); registerRepositoryFragmentsImplementation((RepositoryConfiguration<RepositoryConfigurationSource>) configuration) .stream().peek(it -> { fragmentBeanNames.add(it.getFragmentBeanName()); repositoryCompositionBuilder.addDependsOn(it.getFragmentBeanName()); }).forEach(it -> { builder.addDependsOn(it.getFragmentBeanName()); if (registry.containsBeanDefinition(it.getFragmentBeanName())) { return; } AbstractBeanDefinition fragmentDefinition = buildRepositoryFragmentBean(configuration, it); registry.registerBeanDefinition(it.getFragmentBeanName(), fragmentDefinition); }); repositoryCompositionBuilder.addConstructorArgValue(fragmentBeanNames); AbstractBeanDefinition compositionBeanDefinition = repositoryCompositionBuilder.getBeanDefinition(); compositionBeanDefinition.setSource(configuration.getSource()); builder.addPropertyValue("repositoryComposition", compositionBeanDefinition); RootBeanDefinition evaluationContextProviderDefinition = new RootBeanDefinition( ExtensionAwareEvaluationContextProvider.class); evaluationContextProviderDefinition.setSource(configuration.getSource()); builder.addPropertyValue("evaluationContextProvider", evaluationContextProviderDefinition); return builder; }

Target:
public BeanDefinitionBuilder build(RepositoryConfiguration<?> configuration) { Assert.notNull(registry, "BeanDefinitionRegistry must not be null!"); Assert.notNull(resourceLoader, "ResourceLoader must not be null!"); BeanDefinitionBuilder builder = BeanDefinitionBuilder .rootBeanDefinition(configuration.getRepositoryFactoryBeanClassName()); builder.getRawBeanDefinition().setSource(configuration.getSource()); builder.addConstructorArgValue(configuration.getRepositoryInterface()); builder.addPropertyValue("queryLookupStrategyKey", configuration.getQueryLookupStrategyKey()); builder.addPropertyValue("lazyInit", configuration.isLazyInit()); configuration.getRepositoryBaseClassName() .ifPresent(it -> builder.addPropertyValue("repositoryBaseClass", it)); NamedQueriesBeanDefinitionBuilder definitionBuilder = new NamedQueriesBeanDefinitionBuilder( extension.getDefaultNamedQueryLocation()); configuration.getNamedQueriesLocation().ifPresent(definitionBuilder::setLocations); builder.addPropertyValue("namedQueries", definitionBuilder.build(configuration.getSource())); registerCustomImplementation(configuration).ifPresent(it -> { builder.addPropertyReference("customImplementation", it); builder.addDependsOn(it); }); BeanDefinitionBuilder fragmentsBuilder = BeanDefinitionBuilder .rootBeanDefinition(RepositoryFragmentsFactoryBean.class); List<String> fragmentBeanNames = registerRepositoryFragmentsImplementation(configuration) .stream() .map(RepositoryFragmentConfiguration::getFragmentBeanName) .collect(Collectors.toList()); fragmentsBuilder.addConstructorArgValue(fragmentBeanNames); builder.addPropertyValue("repositoryFragments", ParsingUtils.getSourceBeanDefinition(fragmentsBuilder, configuration.getSource())); RootBeanDefinition evaluationContextProviderDefinition = new RootBeanDefinition( ExtensionAwareEvaluationContextProvider.class); evaluationContextProviderDefinition.setSource(configuration.getSource()); builder.addPropertyValue("evaluationContextProvider", evaluationContextProviderDefinition); return builder; }