org.springframework.data.repository.config.RepositoryConfigurationSource Java Examples
The following examples show how to use
org.springframework.data.repository.config.RepositoryConfigurationSource.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: VaultRepositoryConfigurationExtension.java From spring-vault with Apache License 2.0 | 6 votes |
@Override protected AbstractBeanDefinition getDefaultKeyValueTemplateBeanDefinition( RepositoryConfigurationSource configurationSource) { RootBeanDefinition keyValueTemplateDefinition = new RootBeanDefinition(VaultKeyValueTemplate.class); ConstructorArgumentValues constructorArgumentValuesForKeyValueTemplate = new ConstructorArgumentValues(); constructorArgumentValuesForKeyValueTemplate.addIndexedArgumentValue(0, new RuntimeBeanReference(VAULT_ADAPTER_BEAN_NAME)); constructorArgumentValuesForKeyValueTemplate.addIndexedArgumentValue(1, new RuntimeBeanReference(VAULT_MAPPING_CONTEXT_BEAN_NAME)); keyValueTemplateDefinition.setConstructorArgumentValues(constructorArgumentValuesForKeyValueTemplate); return keyValueTemplateDefinition; }
Example #2
Source File: ReactiveCosmosRepositoryConfigurationExtensionUnitTest.java From spring-data-cosmosdb with MIT License | 5 votes |
private static void assertHashRepo(Class<?> repositoryInterface, Collection<RepositoryConfiguration<RepositoryConfigurationSource>> configs) { for (final RepositoryConfiguration<?> config : configs) { if (config.getRepositoryInterface().equals(repositoryInterface.getName())) { return; } } fail("expected to find config for repository interface " + repositoryInterface.getName() + ", but got: " + configs.toString()); }
Example #3
Source File: MapRepositoryConfigurationExtension.java From spring-data-keyvalue with Apache License 2.0 | 5 votes |
@Override protected AbstractBeanDefinition getDefaultKeyValueTemplateBeanDefinition( RepositoryConfigurationSource configurationSource) { BeanDefinitionBuilder adapterBuilder = BeanDefinitionBuilder.rootBeanDefinition(MapKeyValueAdapter.class); adapterBuilder.addConstructorArgValue(getMapTypeToUse(configurationSource)); BeanDefinitionBuilder builder = BeanDefinitionBuilder.rootBeanDefinition(KeyValueTemplate.class); builder .addConstructorArgValue(ParsingUtils.getSourceBeanDefinition(adapterBuilder, configurationSource.getSource())); builder.setRole(BeanDefinition.ROLE_SUPPORT); return ParsingUtils.getSourceBeanDefinition(builder, configurationSource.getSource()); }
Example #4
Source File: HazelcastRepositoryConfigurationExtension.java From spring-data-hazelcast with Apache License 2.0 | 5 votes |
@Override protected AbstractBeanDefinition getDefaultKeyValueTemplateBeanDefinition(RepositoryConfigurationSource configurationSource) { RootBeanDefinition keyValueTemplateDefinition = new RootBeanDefinition(KeyValueTemplate.class); ConstructorArgumentValues constructorArgumentValuesForKeyValueTemplate = new ConstructorArgumentValues(); constructorArgumentValuesForKeyValueTemplate .addIndexedArgumentValue(0, new RuntimeBeanReference(HAZELCAST_ADAPTER_BEAN_NAME)); constructorArgumentValuesForKeyValueTemplate .addIndexedArgumentValue(1, new RuntimeBeanReference(MAPPING_CONTEXT_BEAN_NAME)); keyValueTemplateDefinition.setConstructorArgumentValues(constructorArgumentValuesForKeyValueTemplate); return keyValueTemplateDefinition; }
Example #5
Source File: HazelcastRepositoryConfigurationExtension.java From spring-data-hazelcast with Apache License 2.0 | 5 votes |
@Override public void registerBeansForRoot(BeanDefinitionRegistry registry, RepositoryConfigurationSource configurationSource) { // register HazelcastKeyValueAdapter String hazelcastInstanceRef = configurationSource.getAttribute("hazelcastInstanceRef").get(); RootBeanDefinition hazelcastKeyValueAdapterDefinition = new RootBeanDefinition(HazelcastKeyValueAdapter.class); ConstructorArgumentValues constructorArgumentValuesForHazelcastKeyValueAdapter = new ConstructorArgumentValues(); constructorArgumentValuesForHazelcastKeyValueAdapter .addIndexedArgumentValue(0, new RuntimeBeanReference(hazelcastInstanceRef)); hazelcastKeyValueAdapterDefinition.setConstructorArgumentValues(constructorArgumentValuesForHazelcastKeyValueAdapter); registerIfNotAlreadyRegistered(() -> hazelcastKeyValueAdapterDefinition, registry, HAZELCAST_ADAPTER_BEAN_NAME, configurationSource); super.registerBeansForRoot(registry, configurationSource); }
Example #6
Source File: MybatisRepositoryConfigExtension.java From spring-data-mybatis with Apache License 2.0 | 5 votes |
@Override public void postProcess(BeanDefinitionBuilder builder, RepositoryConfigurationSource source) { Optional<String> transactionManagerRef = source .getAttribute("transactionManagerRef"); builder.addPropertyValue("transactionManager", transactionManagerRef.orElse(DEFAULT_TRANSACTION_MANAGER_BEAN_NAME)); Optional<String> sqlSessionTemplateRef = source .getAttribute("sqlSessionTemplateRef"); builder.addPropertyReference("sqlSessionTemplate", sqlSessionTemplateRef.orElse(DEFAULT_SQL_SESSION_TEMPLATE_BEAN_NAME)); builder.addPropertyReference("mappingContext", MYBATIS_MAPPING_CONTEXT_BEAN_NAME); }
Example #7
Source File: Neo4jRepositoryConfigurationExtension.java From sdn-rx with Apache License 2.0 | 5 votes |
@Override public void postProcess(BeanDefinitionBuilder builder, RepositoryConfigurationSource source) { builder.addPropertyValue("transactionManager", source.getAttribute("transactionManagerRef").orElse(DEFAULT_TRANSACTION_MANAGER_BEAN_NAME)); builder.addPropertyReference("neo4jOperations", source.getAttribute("neo4jTemplateRef").orElse(DEFAULT_NEO4J_TEMPLATE_BEAN_NAME)); builder.addPropertyReference("neo4jMappingContext", source.getAttribute("neo4jMappingContextRef").orElse(DEFAULT_MAPPING_CONTEXT_BEAN_NAME)); }
Example #8
Source File: CosmosRepositoryConfigurationExtensionUnitTest.java From spring-data-cosmosdb with MIT License | 5 votes |
private static void assertHashRepo(Class<?> repositoryInterface, Collection<RepositoryConfiguration<RepositoryConfigurationSource>> configs) { for (final RepositoryConfiguration<?> config : configs) { if (config.getRepositoryInterface().equals(repositoryInterface.getName())) { return; } } fail("expected to find config for repository interface " + repositoryInterface.getName() + ", but got: " + configs.toString()); }
Example #9
Source File: ReactiveCosmosRepositoryConfigurationExtension.java From spring-data-cosmosdb with MIT License | 5 votes |
@Override public void registerBeansForRoot(BeanDefinitionRegistry registry, RepositoryConfigurationSource config) { super.registerBeansForRoot(registry, config); if (!registry.containsBeanDefinition(Constants.COSMOS_MAPPING_CONTEXT)) { final RootBeanDefinition definition = new RootBeanDefinition(CosmosMappingContext.class); definition.setRole(AbstractBeanDefinition.ROLE_INFRASTRUCTURE); definition.setSource(config.getSource()); registry.registerBeanDefinition(Constants.COSMOS_MAPPING_CONTEXT, definition); } }
Example #10
Source File: CosmosRepositoryConfigurationExtension.java From spring-data-cosmosdb with MIT License | 5 votes |
@Override public void registerBeansForRoot(BeanDefinitionRegistry registry, RepositoryConfigurationSource config) { super.registerBeansForRoot(registry, config); if (!registry.containsBeanDefinition(Constants.COSMOS_MAPPING_CONTEXT)) { final RootBeanDefinition definition = new RootBeanDefinition(CosmosMappingContext.class); definition.setRole(AbstractBeanDefinition.ROLE_INFRASTRUCTURE); definition.setSource(config.getSource()); registry.registerBeanDefinition(Constants.COSMOS_MAPPING_CONTEXT, definition); } }
Example #11
Source File: SolrRepositoryConfigExtension.java From dubbox with Apache License 2.0 | 5 votes |
private void registerSolrMappingContextIfNotPresent(BeanDefinitionRegistry registry, RepositoryConfigurationSource configurationSource) { RootBeanDefinition definition = new RootBeanDefinition(SimpleSolrMappingContext.class); definition.setRole(AbstractBeanDefinition.ROLE_INFRASTRUCTURE); definition.setSource(configurationSource.getSource()); registerIfNotAlreadyRegistered(definition, registry, BeanDefinition.SOLR_MAPPTING_CONTEXT.getBeanName(), definition); }
Example #12
Source File: SolrRepositoryConfigExtension.java From dubbox with Apache License 2.0 | 5 votes |
@Override public void registerBeansForRoot(BeanDefinitionRegistry registry, RepositoryConfigurationSource configurationSource) { super.registerBeansForRoot(registry, configurationSource); registerSolrMappingContextIfNotPresent(registry, configurationSource); registerIfNotAlreadyRegistered( BeanDefinitionBuilder.genericBeanDefinition(SolrExceptionTranslator.class).getBeanDefinition(), registry, "solrExceptionTranslator", configurationSource); }
Example #13
Source File: ReactiveNeo4jRepositoryConfigurationExtension.java From sdn-rx with Apache License 2.0 | 5 votes |
@Override public void postProcess(BeanDefinitionBuilder builder, RepositoryConfigurationSource source) { builder.addPropertyValue("transactionManager", source.getAttribute("transactionManagerRef").orElse(DEFAULT_TRANSACTION_MANAGER_BEAN_NAME)); builder.addPropertyReference("neo4jOperations", source.getAttribute("neo4jTemplateRef").orElse(DEFAULT_NEO4J_TEMPLATE_BEAN_NAME)); builder.addPropertyReference("neo4jMappingContext", source.getAttribute("neo4jMappingContextRef").orElse(DEFAULT_MAPPING_CONTEXT_BEAN_NAME)); }
Example #14
Source File: ReactiveCosmosRepositoryConfigurationExtension.java From spring-data-cosmosdb with MIT License | 4 votes |
@Override public void postProcess(BeanDefinitionBuilder builder, RepositoryConfigurationSource source) { super.postProcess(builder, source); }
Example #15
Source File: CosmosRepositoryConfigurationExtension.java From spring-data-cosmosdb with MIT License | 4 votes |
@Override public void postProcess(BeanDefinitionBuilder builder, RepositoryConfigurationSource source) { super.postProcess(builder, source); }
Example #16
Source File: MapRepositoryConfigurationExtension.java From spring-data-keyvalue with Apache License 2.0 | 4 votes |
@SuppressWarnings({ "unchecked", "rawtypes" }) private static Class<? extends Map> getMapTypeToUse(RepositoryConfigurationSource source) { return (Class<? extends Map>) ((AnnotationMetadata) source.getSource()).getAnnotationAttributes( EnableMapRepositories.class.getName()).get("mapType"); }
Example #17
Source File: VaultRepositoryConfigurationExtension.java From spring-vault with Apache License 2.0 | 3 votes |
@Override public void registerBeansForRoot(BeanDefinitionRegistry registry, RepositoryConfigurationSource configurationSource) { Optional<String> vaultTemplateRef = configurationSource.getAttribute("vaultTemplateRef"); RootBeanDefinition mappingContextDefinition = createVaultMappingContext(configurationSource); mappingContextDefinition.setSource(configurationSource.getSource()); registerIfNotAlreadyRegistered(() -> mappingContextDefinition, registry, VAULT_MAPPING_CONTEXT_BEAN_NAME, configurationSource); // register Adapter RootBeanDefinition vaultKeyValueAdapterDefinition = new RootBeanDefinition(VaultKeyValueAdapter.class); ConstructorArgumentValues constructorArgumentValuesForVaultKeyValueAdapter = new ConstructorArgumentValues(); constructorArgumentValuesForVaultKeyValueAdapter.addIndexedArgumentValue(0, new RuntimeBeanReference(vaultTemplateRef.orElse("vaultTemplate"))); vaultKeyValueAdapterDefinition.setConstructorArgumentValues(constructorArgumentValuesForVaultKeyValueAdapter); registerIfNotAlreadyRegistered(() -> vaultKeyValueAdapterDefinition, registry, VAULT_ADAPTER_BEAN_NAME, configurationSource); Optional<String> keyValueTemplateName = configurationSource.getAttribute(KEY_VALUE_TEMPLATE_BEAN_REF_ATTRIBUTE); // No custom template reference configured and no matching bean definition found if (keyValueTemplateName.isPresent() && getDefaultKeyValueTemplateRef().equals(keyValueTemplateName.get()) && !registry.containsBeanDefinition(keyValueTemplateName.get())) { registerIfNotAlreadyRegistered(() -> getDefaultKeyValueTemplateBeanDefinition(configurationSource), registry, keyValueTemplateName.get(), configurationSource.getSource()); } super.registerBeansForRoot(registry, configurationSource); }
Example #18
Source File: KeyValueRepositoryConfigurationExtension.java From spring-data-keyvalue with Apache License 2.0 | 3 votes |
@Override public void registerBeansForRoot(BeanDefinitionRegistry registry, RepositoryConfigurationSource configurationSource) { super.registerBeansForRoot(registry, configurationSource); registerIfNotAlreadyRegistered(() -> { RootBeanDefinition definitionefinition = new RootBeanDefinition(KeyValueMappingContext.class); definitionefinition.setSource(configurationSource.getSource()); return definitionefinition; }, registry, getMappingContextBeanRef(), configurationSource); Optional<String> keyValueTemplateName = configurationSource.getAttribute(KEY_VALUE_TEMPLATE_BEAN_REF_ATTRIBUTE); // No custom template reference configured and no matching bean definition found if (keyValueTemplateName.isPresent() && getDefaultKeyValueTemplateRef().equals(keyValueTemplateName.get()) && !registry.containsBeanDefinition(keyValueTemplateName.get())) { AbstractBeanDefinition beanDefinition = getDefaultKeyValueTemplateBeanDefinition(configurationSource); if (beanDefinition != null) { registerIfNotAlreadyRegistered(() -> beanDefinition, registry, keyValueTemplateName.get(), configurationSource.getSource()); } } }
Example #19
Source File: MybatisRepositoryConfigExtension.java From spring-data-mybatis with Apache License 2.0 | 3 votes |
@Override public void registerBeansForRoot(BeanDefinitionRegistry registry, RepositoryConfigurationSource config) { super.registerBeansForRoot(registry, config); Object source = config.getSource(); registerLazyIfNotAlreadyRegistered( () -> new RootBeanDefinition(MybatisMappingContextFactoryBean.class), registry, MYBATIS_MAPPING_CONTEXT_BEAN_NAME, source); }
Example #20
Source File: VaultRepositoryConfigurationExtension.java From spring-vault with Apache License 2.0 | 3 votes |
private RootBeanDefinition createVaultMappingContext(RepositoryConfigurationSource configurationSource) { ConstructorArgumentValues mappingContextArgs = new ConstructorArgumentValues(); RootBeanDefinition mappingContextBeanDef = new RootBeanDefinition(VaultMappingContext.class); mappingContextBeanDef.setConstructorArgumentValues(mappingContextArgs); mappingContextBeanDef.setSource(configurationSource.getSource()); return mappingContextBeanDef; }
Example #21
Source File: KeyValueRepositoryConfigurationExtension.java From spring-data-keyvalue with Apache License 2.0 | 2 votes |
/** * Get the default {@link RootBeanDefinition} for {@link org.springframework.data.keyvalue.core.KeyValueTemplate}. * * @return {@literal null} to explicitly not register a template. * @see #getDefaultKeyValueTemplateRef() */ @Nullable protected AbstractBeanDefinition getDefaultKeyValueTemplateBeanDefinition( RepositoryConfigurationSource configurationSource) { return null; }