Search in sources :

Example 1 with BasicServiceInterfaceConfig

use of com.weibo.api.motan.config.BasicServiceInterfaceConfig 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);
            }
        }
    }
}
Also used : BasicServiceInterfaceConfig(com.weibo.api.motan.config.BasicServiceInterfaceConfig) ListableBeanFactory(org.springframework.beans.factory.ListableBeanFactory)

Aggregations

BasicServiceInterfaceConfig (com.weibo.api.motan.config.BasicServiceInterfaceConfig)1 ListableBeanFactory (org.springframework.beans.factory.ListableBeanFactory)1