本文整理匯總了Java中org.springframework.beans.factory.support.GenericBeanDefinition.setSynthetic方法的典型用法代碼示例。如果您正苦於以下問題:Java GenericBeanDefinition.setSynthetic方法的具體用法?Java GenericBeanDefinition.setSynthetic怎麽用?Java GenericBeanDefinition.setSynthetic使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.springframework.beans.factory.support.GenericBeanDefinition
的用法示例。
在下文中一共展示了GenericBeanDefinition.setSynthetic方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: registerBeanDefinitions
import org.springframework.beans.factory.support.GenericBeanDefinition; //導入方法依賴的package包/類
@Override
public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) {
Map<Object, Object> targetDataSources = new HashMap<Object, Object>();
// 將主數據源添加到更多數據源中
targetDataSources.put("dataSource", defaultDataSource);
DynamicDataSourceContextHolder.dataSourceIds.add("dataSource");
// 添加更多數據源
targetDataSources.putAll(customDataSources);
for (String key : customDataSources.keySet()) {
DynamicDataSourceContextHolder.dataSourceIds.add(key);
}
// 創建DynamicDataSource
GenericBeanDefinition beanDefinition = new GenericBeanDefinition();
beanDefinition.setBeanClass(DynamicDataSource.class);
beanDefinition.setSynthetic(true);
MutablePropertyValues mpv = beanDefinition.getPropertyValues();
mpv.addPropertyValue("defaultTargetDataSource", defaultDataSource);
mpv.addPropertyValue("targetDataSources", targetDataSources);
registry.registerBeanDefinition("dataSource", beanDefinition);
logger.info("Dynamic DataSource Registry");
}
示例2: createBeanReferenceDefinition
import org.springframework.beans.factory.support.GenericBeanDefinition; //導入方法依賴的package包/類
private AbstractBeanDefinition createBeanReferenceDefinition(String beanName, BeanDefinition actualDef) {
GenericBeanDefinition def = new GenericBeanDefinition();
def.setBeanClass(BeanReferenceFactoryBean.class);
def.setAttribute(GENERATED_REF, Boolean.TRUE);
def.setOriginatingBeanDefinition(actualDef);
def.setDependsOn(new String[] { beanName });
def.setSynthetic(true);
MutablePropertyValues mpv = new MutablePropertyValues();
mpv.addPropertyValue(TARGET_BEAN_NAME_PROP, beanName);
def.setPropertyValues(mpv);
return def;
}
示例3: registerBeanDefinitions
import org.springframework.beans.factory.support.GenericBeanDefinition; //導入方法依賴的package包/類
@Override
public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("動態數據源注冊開始>>>");
}
// 添加主數據源
targetDataSources.put("master", DynamicDataSourceHolder.getMasterDS());
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("提供可選取Master數據源:{}", "master");
}
// 添加從數據源
targetDataSources.putAll(DynamicDataSourceHolder.getSlaveDSMap());
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("提供可選取Slave數據源:{}", DynamicDataSourceHolder.getSlaveDSMap().keySet());
}
for (String key : DynamicDataSourceHolder.getSlaveDSMap().keySet()) {
DynamicDataSourceHolder.getSlaveDSKeys().add(key);
}
// 創建DynamicDataSource
GenericBeanDefinition beanDefinition = new GenericBeanDefinition();
beanDefinition.setBeanClass(DynamicDataSource.class);
beanDefinition.setSynthetic(true);
MutablePropertyValues mpv = beanDefinition.getPropertyValues();
mpv.addPropertyValue("defaultTargetDataSource", DynamicDataSourceHolder.getMasterDS());
mpv.addPropertyValue("targetDataSources", targetDataSources);
registry.registerBeanDefinition("dataSource", beanDefinition);
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("<<<動態數據源注冊結束");
}
}
示例4: registerDynamicDataSourceBeanDefinition
import org.springframework.beans.factory.support.GenericBeanDefinition; //導入方法依賴的package包/類
/**
* @Title: registerDynamicDataSourceBeanDefinition
* @Description: 注冊動態數據源
* @author Kola 6089555
* @date 2017年4月26日 下午1:26:55
* @param registry
*/
private void registerDynamicDataSourceBeanDefinition(BeanDefinitionRegistry registry) {
GenericBeanDefinition beanDefinition = new GenericBeanDefinition();
beanDefinition.setBeanClass(DynamicDataSource.class);
beanDefinition.setSynthetic(true);
beanDefinition.setPrimary(true);
MutablePropertyValues mpv = beanDefinition.getPropertyValues();
mpv.addPropertyValue("defaultTargetDataSource", defaultDataSource);
mpv.addPropertyValue("targetDataSources", targetDataSources);
registry.registerBeanDefinition("dataSource", beanDefinition);
LOGGER.info("Dynamic DataSource Registry");
}
開發者ID:6089555,項目名稱:spring-boot-starter-dynamic-datasource,代碼行數:19,代碼來源:DynamicDataSourceRegister.java
示例5: addEntityScanBeanPostProcessor
import org.springframework.beans.factory.support.GenericBeanDefinition; //導入方法依賴的package包/類
private void addEntityScanBeanPostProcessor(BeanDefinitionRegistry registry,
Set<String> packagesToScan) {
GenericBeanDefinition beanDefinition = new GenericBeanDefinition();
beanDefinition.setBeanClass(EntityScanBeanPostProcessor.class);
beanDefinition.getConstructorArgumentValues()
.addGenericArgumentValue(toArray(packagesToScan));
beanDefinition.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
// We don't need this one to be post processed otherwise it can cause a
// cascade of bean instantiation that we would rather avoid.
beanDefinition.setSynthetic(true);
registry.registerBeanDefinition(BEAN_NAME, beanDefinition);
}
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:13,代碼來源:EntityScanRegistrar.java
示例6: registerBeanDefinitions
import org.springframework.beans.factory.support.GenericBeanDefinition; //導入方法依賴的package包/類
@Override
public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata,
BeanDefinitionRegistry registry) {
if (!registry.containsBeanDefinition(BEAN_NAME)) {
GenericBeanDefinition beanDefinition = new GenericBeanDefinition();
beanDefinition.setBeanClass(DataSourceInitializerPostProcessor.class);
beanDefinition.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
// We don't need this one to be post processed otherwise it can cause a
// cascade of bean instantiation that we would rather avoid.
beanDefinition.setSynthetic(true);
registry.registerBeanDefinition(BEAN_NAME, beanDefinition);
}
}
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:14,代碼來源:DataSourceInitializerPostProcessor.java
示例7: registerBeanDefinitions
import org.springframework.beans.factory.support.GenericBeanDefinition; //導入方法依賴的package包/類
@Override
public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata,
BeanDefinitionRegistry registry) {
if (!registry.containsBeanDefinition(BEAN_NAME)) {
GenericBeanDefinition beanDefinition = new GenericBeanDefinition();
beanDefinition.setBeanClass(DataSourceInitializedPublisher.class);
beanDefinition.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
// We don't need this one to be post processed otherwise it can cause a
// cascade of bean instantiation that we would rather avoid.
beanDefinition.setSynthetic(true);
registry.registerBeanDefinition(BEAN_NAME, beanDefinition);
}
}
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:14,代碼來源:DataSourceInitializedPublisher.java
示例8: addEntityScanBeanPostProcessor
import org.springframework.beans.factory.support.GenericBeanDefinition; //導入方法依賴的package包/類
private void addEntityScanBeanPostProcessor(BeanDefinitionRegistry registry,
Set<String> packagesToScan) {
GenericBeanDefinition beanDefinition = new GenericBeanDefinition();
beanDefinition.setBeanClass(this.beanPostProcessorType);
beanDefinition.getConstructorArgumentValues()
.addGenericArgumentValue(toArray(packagesToScan));
beanDefinition.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
// We don't need this one to be post processed otherwise it can cause a
// cascade of bean instantiation that we would rather avoid.
beanDefinition.setSynthetic(true);
registry.registerBeanDefinition(this.beanPostProcessorName, beanDefinition);
}