Java Code Examples for org.springframework.data.repository.config.RepositoryConfigurationSource#getAttribute()
The following examples show how to use
org.springframework.data.repository.config.RepositoryConfigurationSource#getAttribute() .
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: 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 2
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 3
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()); } } }