use of org.springframework.beans.factory.ListableBeanFactory in project motan by weibocom.
the class RefererConfigBean method checkAndConfigBasicConfig.
/**
* 检查并配置basicConfig
*/
private void checkAndConfigBasicConfig() {
if (getBasicReferer() == null) {
if (MotanNamespaceHandler.basicRefererConfigDefineNames.size() == 0) {
if (beanFactory instanceof ListableBeanFactory) {
ListableBeanFactory listableBeanFactory = (ListableBeanFactory) beanFactory;
String[] basicRefererConfigNames = listableBeanFactory.getBeanNamesForType(BasicRefererInterfaceConfig.class);
MotanNamespaceHandler.basicRefererConfigDefineNames.addAll(Arrays.asList(basicRefererConfigNames));
}
}
for (String name : MotanNamespaceHandler.basicRefererConfigDefineNames) {
BasicRefererInterfaceConfig biConfig = beanFactory.getBean(name, BasicRefererInterfaceConfig.class);
if (biConfig == null) {
continue;
}
if (MotanNamespaceHandler.basicRefererConfigDefineNames.size() == 1) {
setBasicReferer(biConfig);
} else if (biConfig.isDefault() != null && biConfig.isDefault().booleanValue()) {
setBasicReferer(biConfig);
}
}
}
}
use of org.springframework.beans.factory.ListableBeanFactory in project motan by weibocom.
the class ServiceConfigBean method checkAndConfigBasicConfig.
/**
* 检查并配置basicConfig
*/
private void checkAndConfigBasicConfig() {
if (getBasicServiceConfig() == null) {
if (MotanNamespaceHandler.basicServiceConfigDefineNames.size() == 0) {
if (beanFactory instanceof ListableBeanFactory) {
ListableBeanFactory listableBeanFactory = (ListableBeanFactory) beanFactory;
String[] basicServiceConfigNames = listableBeanFactory.getBeanNamesForType(BasicServiceInterfaceConfig.class);
MotanNamespaceHandler.basicServiceConfigDefineNames.addAll(Arrays.asList(basicServiceConfigNames));
}
}
for (String name : MotanNamespaceHandler.basicServiceConfigDefineNames) {
BasicServiceInterfaceConfig biConfig = beanFactory.getBean(name, BasicServiceInterfaceConfig.class);
if (biConfig == null) {
continue;
}
if (MotanNamespaceHandler.basicServiceConfigDefineNames.size() == 1) {
setBasicServiceConfig(biConfig);
} else if (biConfig.isDefault() != null && biConfig.isDefault().booleanValue()) {
setBasicServiceConfig(biConfig);
}
}
}
}
Aggregations