com.alibaba.dubbo.config.ProviderConfig Java Examples

The following examples show how to use com.alibaba.dubbo.config.ProviderConfig. 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: DubboAutoConfiguration.java    From spring-boot-starter-dubbo with Apache License 2.0 6 votes vote down vote up
private void registerProvider(ProviderConfig provider, ConfigurableListableBeanFactory beanFactory) {
	if (provider != null) {
		String beanName = provider.getId();
		if (StringUtils.isEmpty(beanName)) {
			beanName = "providerConfig";
		}
		String filter = provider.getFilter();
		if (StringUtils.isEmpty(filter)) {
			filter = "regerProviderFilter";
		} else {
			filter = filter.trim() + ",regerProviderFilter";
		}
		logger.debug("添加consumerFilter后的Filter, {}", filter);
		provider.setFilter(filter);
		beanFactory.registerSingleton(beanName, provider);
	} else {
		logger.debug("dubbo 没有配置默认的生成者参数");
	}
}
 
Example #2
Source File: DubboAutoConfiguration.java    From spring-boot-starter-dubbo with Apache License 2.0 5 votes vote down vote up
@Override
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
	DubboProperties dubboProperties = this.getPropertiesConfigurationBean(DubboProperties.targetName, DubboProperties.class);
	ApplicationConfig application = dubboProperties.getApplication();
	MonitorConfig monitor = dubboProperties.getMonitor();
	ModuleConfig module = dubboProperties.getModule();
	ProviderConfig provider = dubboProperties.getProvider();
	ConsumerConfig consumer = dubboProperties.getConsumer();
	List<ProtocolConfig> protocols = this.getProtocols(dubboProperties);
	List<RegistryConfig> registryConfigs = this.getRegistrys(dubboProperties);
	List<ReferenceConfig<?>> references = dubboProperties.getReferences();
	List<ServiceConfig<?>> services = dubboProperties.getServices();
	this.registerRegistry(registryConfigs, beanFactory);

	String basePackage = dubboProperties.getBasePackage();

	if (provider != null) {
		provider.setProtocols(this.getProtocol(protocols, "spring.dubbo.provider.protocol"));
		provider.setRegistries(this.getRegistry(registryConfigs, "spring.dubbo.provider.registry"));
	}

	if (consumer != null) {
		consumer.setRegistries(this.getRegistry(registryConfigs, "spring.dubbo.consumer.registry"));
	}

	this.registerThis(basePackage, beanFactory);
	this.registerApplication(application, beanFactory);
	this.registerProtocols(protocols, beanFactory);
	this.registerMonitor(monitor, beanFactory);
	this.registerModule(module, beanFactory);
	this.registerProvider(provider, beanFactory);
	this.registerConsumer(consumer, beanFactory);
	this.registerReferences(references, beanFactory);
	this.registerServices(services, beanFactory);
	super.postProcessBeanFactory(beanFactory);
	super.postProcessAnnotationPackageService();
}
 
Example #3
Source File: UrlTestBase.java    From dubbox with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("deprecation")
protected void initServConf() {
    
    appConfForProvider = new ApplicationConfig();
    appConfForService = new ApplicationConfig();
    regConfForProvider = new RegistryConfig();
    regConfForService = new RegistryConfig();
    provConf = new ProviderConfig();
    protoConfForProvider = new ProtocolConfig();
    protoConfForService = new ProtocolConfig();
    methodConfForService = new MethodConfig();
    servConf = new ServiceConfig<DemoService>();
    
    provConf.setApplication(appConfForProvider);
    servConf.setApplication(appConfForService);
    
    provConf.setRegistry(regConfForProvider);
    servConf.setRegistry(regConfForService);
    
    provConf.setProtocols(Arrays.asList(new ProtocolConfig[]{protoConfForProvider}));
    servConf.setProtocols(Arrays.asList(new ProtocolConfig[]{protoConfForService}));
    
    servConf.setMethods(Arrays.asList(new MethodConfig[]{methodConfForService}));
    servConf.setProvider(provConf);
    
    servConf.setRef(demoService);
    servConf.setInterfaceClass(DemoService.class);
   
    methodConfForService.setName("sayName");
    regConfForService.setAddress("127.0.0.1:9090");
    regConfForService.setProtocol("mockregistry");
    appConfForService.setName("ConfigTests");
}
 
Example #4
Source File: DubboNamespaceHandler.java    From dubbox with Apache License 2.0 5 votes vote down vote up
public void init() {
 registerBeanDefinitionParser("application", new DubboBeanDefinitionParser(ApplicationConfig.class, true));
    registerBeanDefinitionParser("module", new DubboBeanDefinitionParser(ModuleConfig.class, true));
    registerBeanDefinitionParser("registry", new DubboBeanDefinitionParser(RegistryConfig.class, true));
    registerBeanDefinitionParser("monitor", new DubboBeanDefinitionParser(MonitorConfig.class, true));
    registerBeanDefinitionParser("provider", new DubboBeanDefinitionParser(ProviderConfig.class, true));
    registerBeanDefinitionParser("consumer", new DubboBeanDefinitionParser(ConsumerConfig.class, true));
    registerBeanDefinitionParser("protocol", new DubboBeanDefinitionParser(ProtocolConfig.class, true));
    registerBeanDefinitionParser("service", new DubboBeanDefinitionParser(ServiceBean.class, true));
    registerBeanDefinitionParser("reference", new DubboBeanDefinitionParser(ReferenceBean.class, false));
    registerBeanDefinitionParser("annotation", new DubboBeanDefinitionParser(AnnotationBean.class, true));
}
 
Example #5
Source File: ServiceBean.java    From dubbox with Apache License 2.0 5 votes vote down vote up
private boolean isDelay() {
    Integer delay = getDelay();
    ProviderConfig provider = getProvider();
    if (delay == null && provider != null) {
        delay = provider.getDelay();
    }
    return supportedApplicationListener && (delay == null || delay.intValue() == -1);
}
 
Example #6
Source File: DubboConfiguration.java    From cicada with MIT License 5 votes vote down vote up
@Bean
public ProviderConfig dubboProvider() {
  final ProviderConfig provider = new ProviderConfig();
  provider.setProtocol(this.dubboProtocol());
  provider.setRetries(dubboProperty.getProviderRetries());
  provider.setActives(dubboProperty.getProviderActives());
  provider.setAccepts(dubboProperty.getProviderAccepts());
  provider.setTimeout(dubboProperty.getProviderTimeout());
  provider.setToken(dubboProperty.getProviderToken());
  return provider;
}
 
Example #7
Source File: UrlTestBase.java    From dubbox with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("deprecation")
protected void initServConf() {
    
    appConfForProvider = new ApplicationConfig();
    appConfForService = new ApplicationConfig();
    regConfForProvider = new RegistryConfig();
    regConfForService = new RegistryConfig();
    provConf = new ProviderConfig();
    protoConfForProvider = new ProtocolConfig();
    protoConfForService = new ProtocolConfig();
    methodConfForService = new MethodConfig();
    servConf = new ServiceConfig<DemoService>();
    
    provConf.setApplication(appConfForProvider);
    servConf.setApplication(appConfForService);
    
    provConf.setRegistry(regConfForProvider);
    servConf.setRegistry(regConfForService);
    
    provConf.setProtocols(Arrays.asList(new ProtocolConfig[]{protoConfForProvider}));
    servConf.setProtocols(Arrays.asList(new ProtocolConfig[]{protoConfForService}));
    
    servConf.setMethods(Arrays.asList(new MethodConfig[]{methodConfForService}));
    servConf.setProvider(provConf);
    
    servConf.setRef(demoService);
    servConf.setInterfaceClass(DemoService.class);
   
    methodConfForService.setName("sayName");
    regConfForService.setAddress("127.0.0.1:9090");
    regConfForService.setProtocol("mockregistry");
    appConfForService.setName("ConfigTests");
}
 
Example #8
Source File: DubboNamespaceHandler.java    From dubbox with Apache License 2.0 5 votes vote down vote up
public void init() {
 registerBeanDefinitionParser("application", new DubboBeanDefinitionParser(ApplicationConfig.class, true));
    registerBeanDefinitionParser("module", new DubboBeanDefinitionParser(ModuleConfig.class, true));
    registerBeanDefinitionParser("registry", new DubboBeanDefinitionParser(RegistryConfig.class, true));
    registerBeanDefinitionParser("monitor", new DubboBeanDefinitionParser(MonitorConfig.class, true));
    registerBeanDefinitionParser("provider", new DubboBeanDefinitionParser(ProviderConfig.class, true));
    registerBeanDefinitionParser("consumer", new DubboBeanDefinitionParser(ConsumerConfig.class, true));
    registerBeanDefinitionParser("protocol", new DubboBeanDefinitionParser(ProtocolConfig.class, true));
    registerBeanDefinitionParser("service", new DubboBeanDefinitionParser(ServiceBean.class, true));
    registerBeanDefinitionParser("reference", new DubboBeanDefinitionParser(ReferenceBean.class, false));
    registerBeanDefinitionParser("annotation", new DubboBeanDefinitionParser(AnnotationBean.class, true));
}
 
Example #9
Source File: ServiceBean.java    From dubbox with Apache License 2.0 5 votes vote down vote up
private boolean isDelay() {
    Integer delay = getDelay();
    ProviderConfig provider = getProvider();
    if (delay == null && provider != null) {
        delay = provider.getDelay();
    }
    return supportedApplicationListener && (delay == null || delay.intValue() == -1);
}
 
Example #10
Source File: UrlTestBase.java    From dubbo3 with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("deprecation")
protected void initServConf() {
    
    appConfForProvider = new ApplicationConfig();
    appConfForService = new ApplicationConfig();
    regConfForProvider = new RegistryConfig();
    regConfForService = new RegistryConfig();
    provConf = new ProviderConfig();
    protoConfForProvider = new ProtocolConfig();
    protoConfForService = new ProtocolConfig();
    methodConfForService = new MethodConfig();
    servConf = new ServiceConfig<DemoService>();
    
    provConf.setApplication(appConfForProvider);
    servConf.setApplication(appConfForService);
    
    provConf.setRegistry(regConfForProvider);
    servConf.setRegistry(regConfForService);
    
    provConf.setProtocols(Arrays.asList(new ProtocolConfig[]{protoConfForProvider}));
    servConf.setProtocols(Arrays.asList(new ProtocolConfig[]{protoConfForService}));
    
    servConf.setMethods(Arrays.asList(new MethodConfig[]{methodConfForService}));
    servConf.setProvider(provConf);
    
    servConf.setRef(demoService);
    servConf.setInterfaceClass(DemoService.class);
   
    methodConfForService.setName("sayName");
    regConfForService.setAddress("127.0.0.1:9090");
    regConfForService.setProtocol("mockregistry");
    appConfForService.setName("ConfigTests");
}
 
Example #11
Source File: DubboNamespaceHandler.java    From dubbo3 with Apache License 2.0 5 votes vote down vote up
public void init() {
 registerBeanDefinitionParser("application", new DubboBeanDefinitionParser(ApplicationConfig.class, true));
    registerBeanDefinitionParser("module", new DubboBeanDefinitionParser(ModuleConfig.class, true));
    registerBeanDefinitionParser("registry", new DubboBeanDefinitionParser(RegistryConfig.class, true));
    registerBeanDefinitionParser("monitor", new DubboBeanDefinitionParser(MonitorConfig.class, true));
    registerBeanDefinitionParser("provider", new DubboBeanDefinitionParser(ProviderConfig.class, true));
    registerBeanDefinitionParser("consumer", new DubboBeanDefinitionParser(ConsumerConfig.class, true));
    registerBeanDefinitionParser("protocol", new DubboBeanDefinitionParser(ProtocolConfig.class, true));
    registerBeanDefinitionParser("service", new DubboBeanDefinitionParser(ServiceBean.class, true));
    registerBeanDefinitionParser("reference", new DubboBeanDefinitionParser(ReferenceBean.class, false));
    registerBeanDefinitionParser("annotation", new DubboBeanDefinitionParser(AnnotationBean.class, true));
}
 
Example #12
Source File: ServiceBean.java    From dubbo-2.6.5 with Apache License 2.0 5 votes vote down vote up
private boolean isDelay() {
    Integer delay = getDelay();
    ProviderConfig provider = getProvider();
    if (delay == null && provider != null) {
        delay = provider.getDelay();
    }
    return supportedApplicationListener && (delay == null || delay == -1);
}
 
Example #13
Source File: UrlTestBase.java    From dubbox-hystrix with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("deprecation")
protected void initServConf() {
    
    appConfForProvider = new ApplicationConfig();
    appConfForService = new ApplicationConfig();
    regConfForProvider = new RegistryConfig();
    regConfForService = new RegistryConfig();
    provConf = new ProviderConfig();
    protoConfForProvider = new ProtocolConfig();
    protoConfForService = new ProtocolConfig();
    methodConfForService = new MethodConfig();
    servConf = new ServiceConfig<DemoService>();
    
    provConf.setApplication(appConfForProvider);
    servConf.setApplication(appConfForService);
    
    provConf.setRegistry(regConfForProvider);
    servConf.setRegistry(regConfForService);
    
    provConf.setProtocols(Arrays.asList(new ProtocolConfig[]{protoConfForProvider}));
    servConf.setProtocols(Arrays.asList(new ProtocolConfig[]{protoConfForService}));
    
    servConf.setMethods(Arrays.asList(new MethodConfig[]{methodConfForService}));
    servConf.setProvider(provConf);
    
    servConf.setRef(demoService);
    servConf.setInterfaceClass(DemoService.class);
   
    methodConfForService.setName("sayName");
    regConfForService.setAddress("127.0.0.1:9090");
    regConfForService.setProtocol("mockregistry");
    appConfForService.setName("ConfigTests");
}
 
Example #14
Source File: DubboNamespaceHandler.java    From dubbox-hystrix with Apache License 2.0 5 votes vote down vote up
public void init() {
 registerBeanDefinitionParser("application", new DubboBeanDefinitionParser(ApplicationConfig.class, true));
    registerBeanDefinitionParser("module", new DubboBeanDefinitionParser(ModuleConfig.class, true));
    registerBeanDefinitionParser("registry", new DubboBeanDefinitionParser(RegistryConfig.class, true));
    registerBeanDefinitionParser("monitor", new DubboBeanDefinitionParser(MonitorConfig.class, true));
    registerBeanDefinitionParser("provider", new DubboBeanDefinitionParser(ProviderConfig.class, true));
    registerBeanDefinitionParser("consumer", new DubboBeanDefinitionParser(ConsumerConfig.class, true));
    registerBeanDefinitionParser("protocol", new DubboBeanDefinitionParser(ProtocolConfig.class, true));
    registerBeanDefinitionParser("service", new DubboBeanDefinitionParser(ServiceBean.class, true));
    registerBeanDefinitionParser("reference", new DubboBeanDefinitionParser(ReferenceBean.class, false));
    registerBeanDefinitionParser("annotation", new DubboBeanDefinitionParser(AnnotationBean.class, true));
}
 
Example #15
Source File: UrlTestBase.java    From dubbox with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("deprecation")
protected void initServConf() {
    
    appConfForProvider = new ApplicationConfig();
    appConfForService = new ApplicationConfig();
    regConfForProvider = new RegistryConfig();
    regConfForService = new RegistryConfig();
    provConf = new ProviderConfig();
    protoConfForProvider = new ProtocolConfig();
    protoConfForService = new ProtocolConfig();
    methodConfForService = new MethodConfig();
    servConf = new ServiceConfig<DemoService>();
    
    provConf.setApplication(appConfForProvider);
    servConf.setApplication(appConfForService);
    
    provConf.setRegistry(regConfForProvider);
    servConf.setRegistry(regConfForService);
    
    provConf.setProtocols(Arrays.asList(new ProtocolConfig[]{protoConfForProvider}));
    servConf.setProtocols(Arrays.asList(new ProtocolConfig[]{protoConfForService}));
    
    servConf.setMethods(Arrays.asList(new MethodConfig[]{methodConfForService}));
    servConf.setProvider(provConf);
    
    servConf.setRef(demoService);
    servConf.setInterfaceClass(DemoService.class);
   
    methodConfForService.setName("sayName");
    regConfForService.setAddress("127.0.0.1:9090");
    regConfForService.setProtocol("mockregistry");
    appConfForService.setName("ConfigTests");
}
 
Example #16
Source File: DubboNamespaceHandler.java    From dubbo-2.6.5 with Apache License 2.0 5 votes vote down vote up
@Override
    public void init() {
//        xml配置解析=》
        registerBeanDefinitionParser("application", new DubboBeanDefinitionParser(ApplicationConfig.class, true));
        registerBeanDefinitionParser("module", new DubboBeanDefinitionParser(ModuleConfig.class, true));
        registerBeanDefinitionParser("registry", new DubboBeanDefinitionParser(RegistryConfig.class, true));
        registerBeanDefinitionParser("monitor", new DubboBeanDefinitionParser(MonitorConfig.class, true));
        registerBeanDefinitionParser("provider", new DubboBeanDefinitionParser(ProviderConfig.class, true));
        registerBeanDefinitionParser("consumer", new DubboBeanDefinitionParser(ConsumerConfig.class, true));
        registerBeanDefinitionParser("protocol", new DubboBeanDefinitionParser(ProtocolConfig.class, true));
        registerBeanDefinitionParser("service", new DubboBeanDefinitionParser(ServiceBean.class, true));
        registerBeanDefinitionParser("reference", new DubboBeanDefinitionParser(ReferenceBean.class, false));
//        annotation解析<dubbo:annotation package="" />xml配置=》
        registerBeanDefinitionParser("annotation", new AnnotationBeanDefinitionParser());
    }
 
Example #17
Source File: EnableDubboConfigTest.java    From dubbo-2.6.5 with Apache License 2.0 5 votes vote down vote up
@Test
public void testSingle() {

    AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
    context.register(TestConfig.class);
    context.refresh();

    // application
    ApplicationConfig applicationConfig = context.getBean("applicationBean", ApplicationConfig.class);
    Assert.assertEquals("dubbo-demo-application", applicationConfig.getName());

    // module
    ModuleConfig moduleConfig = context.getBean("moduleBean", ModuleConfig.class);
    Assert.assertEquals("dubbo-demo-module", moduleConfig.getName());

    // registry
    RegistryConfig registryConfig = context.getBean(RegistryConfig.class);
    Assert.assertEquals("zookeeper://192.168.99.100:32770", registryConfig.getAddress());

    // protocol
    ProtocolConfig protocolConfig = context.getBean(ProtocolConfig.class);
    Assert.assertEquals("dubbo", protocolConfig.getName());
    Assert.assertEquals(Integer.valueOf(20880), protocolConfig.getPort());

    // monitor
    MonitorConfig monitorConfig = context.getBean(MonitorConfig.class);
    Assert.assertEquals("zookeeper://127.0.0.1:32770", monitorConfig.getAddress());

    // provider
    ProviderConfig providerConfig = context.getBean(ProviderConfig.class);
    Assert.assertEquals("127.0.0.1", providerConfig.getHost());


    // consumer
    ConsumerConfig consumerConfig = context.getBean(ConsumerConfig.class);
    Assert.assertEquals("netty", consumerConfig.getClient());

}
 
Example #18
Source File: DubboNamespaceHandlerTest.java    From dubbo-2.6.5 with Apache License 2.0 5 votes vote down vote up
@Test
public void testTimeoutConfig() {
    ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(ConfigTest.class.getPackage().getName().replace('.', '/') + "/provider-nested-service.xml");
    ctx.start();

    Map<String, ProviderConfig> providerConfigMap = ctx.getBeansOfType(ProviderConfig.class);

    assertThat(providerConfigMap.get("com.alibaba.dubbo.config.ProviderConfig").getTimeout(), is(2000));
}
 
Example #19
Source File: UrlTestBase.java    From dubbo-2.6.5 with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("deprecation")
protected void initServConf() {

    appConfForProvider = new ApplicationConfig();
    appConfForService = new ApplicationConfig();
    regConfForProvider = new RegistryConfig();
    regConfForService = new RegistryConfig();
    provConf = new ProviderConfig();
    protoConfForProvider = new ProtocolConfig();
    protoConfForService = new ProtocolConfig();
    methodConfForService = new MethodConfig();
    servConf = new ServiceConfig<DemoService>();

    provConf.setApplication(appConfForProvider);
    servConf.setApplication(appConfForService);

    provConf.setRegistry(regConfForProvider);
    servConf.setRegistry(regConfForService);

    provConf.setProtocols(Arrays.asList(new ProtocolConfig[]{protoConfForProvider}));
    servConf.setProtocols(Arrays.asList(new ProtocolConfig[]{protoConfForService}));

    servConf.setMethods(Arrays.asList(new MethodConfig[]{methodConfForService}));
    servConf.setProvider(provConf);

    servConf.setRef(demoService);
    servConf.setInterfaceClass(DemoService.class);

    methodConfForService.setName("sayName");
    regConfForService.setAddress("127.0.0.1:9090");
    regConfForService.setProtocol("mockregistry");
    appConfForService.setName("ConfigTests");
}
 
Example #20
Source File: DubboMonitorProvider.java    From EasyTransaction with Apache License 2.0 5 votes vote down vote up
public DubboMonitorProvider(String appId, EasyTransFilterChainFactory filterChainFactory, Optional<ApplicationConfig> applicationConfig,
        Optional<RegistryConfig> registryConfig,Optional<ProtocolConfig> protocolConfig,Optional<ProviderConfig> providerConfig,Optional<ModuleConfig> moduleConfig,Optional<MonitorConfig> monitorConfig, Optional<DubboServiceCustomizationer> customizationer,List<EtMonitor> etMonitorList) {
    super();
    this.appId = appId;
    this.applicationConfig = applicationConfig.orElse(null);
    this.registryConfig = registryConfig.orElse(null);
    this.protocolConfig = protocolConfig.orElse(null);
    this.providerConfig = providerConfig.orElse(null);
    this.moduleConfig = moduleConfig.orElse(null);
    this.monitorConfig = monitorConfig.orElse(null);
    this.customizationer = customizationer.orElse(null);
    this.etMonitorList = etMonitorList;
}
 
Example #21
Source File: DubboEasyTransRpcProviderImpl.java    From EasyTransaction with Apache License 2.0 5 votes vote down vote up
public DubboEasyTransRpcProviderImpl(EasyTransFilterChainFactory filterChainFactory, Optional<ApplicationConfig> applicationConfig,
		Optional<RegistryConfig> registryConfig,Optional<ProtocolConfig> protocolConfig,Optional<ProviderConfig> providerConfig,Optional<ModuleConfig> moduleConfig,Optional<MonitorConfig> monitorConfig, Optional<DubboServiceCustomizationer> customizationer) {
	super();
	this.filterChainFactory = filterChainFactory;
	this.applicationConfig = applicationConfig.orElse(null);
	this.registryConfig = registryConfig.orElse(null);
	this.protocolConfig = protocolConfig.orElse(null);
	this.providerConfig = providerConfig.orElse(null);
	this.moduleConfig = moduleConfig.orElse(null);
	this.monitorConfig = monitorConfig.orElse(null);
	this.customizationer = customizationer.orElse(null);
	injectHelper = this;
}
 
Example #22
Source File: ServiceBean.java    From dubbox-hystrix with Apache License 2.0 5 votes vote down vote up
private boolean isDelay() {
    Integer delay = getDelay();
    ProviderConfig provider = getProvider();
    if (delay == null && provider != null) {
        delay = provider.getDelay();
    }
    return supportedApplicationListener && (delay == null || delay.intValue() == -1);
}
 
Example #23
Source File: ServiceBean.java    From dubbox with Apache License 2.0 5 votes vote down vote up
private boolean isDelay() {
    Integer delay = getDelay();
    ProviderConfig provider = getProvider();
    if (delay == null && provider != null) {
        delay = provider.getDelay();
    }
    return supportedApplicationListener && (delay == null || delay.intValue() == -1);
}
 
Example #24
Source File: DubboNamespaceHandler.java    From dubbox with Apache License 2.0 5 votes vote down vote up
public void init() {
 registerBeanDefinitionParser("application", new DubboBeanDefinitionParser(ApplicationConfig.class, true));
    registerBeanDefinitionParser("module", new DubboBeanDefinitionParser(ModuleConfig.class, true));
    registerBeanDefinitionParser("registry", new DubboBeanDefinitionParser(RegistryConfig.class, true));
    registerBeanDefinitionParser("monitor", new DubboBeanDefinitionParser(MonitorConfig.class, true));
    registerBeanDefinitionParser("provider", new DubboBeanDefinitionParser(ProviderConfig.class, true));
    registerBeanDefinitionParser("consumer", new DubboBeanDefinitionParser(ConsumerConfig.class, true));
    registerBeanDefinitionParser("protocol", new DubboBeanDefinitionParser(ProtocolConfig.class, true));
    registerBeanDefinitionParser("service", new DubboBeanDefinitionParser(ServiceBean.class, true));
    registerBeanDefinitionParser("reference", new DubboBeanDefinitionParser(ReferenceBean.class, false));
    registerBeanDefinitionParser("annotation", new DubboBeanDefinitionParser(AnnotationBean.class, true));
}
 
Example #25
Source File: DubboEasyTransRpcConfiguration.java    From EasyTransaction with Apache License 2.0 4 votes vote down vote up
@Bean
@ConditionalOnMissingBean(EasyTransRpcProvider.class)
public DubboEasyTransRpcProviderImpl onsEasyTransMsgPublisherImpl(EasyTransFilterChainFactory filterChainFactory, Optional<ApplicationConfig> applicationConfig,
		Optional<RegistryConfig> registryConfig,Optional<ProtocolConfig> protocolConfig,Optional<ProviderConfig> providerConfig,Optional<ModuleConfig> moduleConfig,Optional<MonitorConfig> monitorConfig, Optional<DubboServiceCustomizationer> customizationer){
	return new DubboEasyTransRpcProviderImpl(filterChainFactory, applicationConfig, registryConfig, protocolConfig, providerConfig, moduleConfig, monitorConfig, customizationer);
}
 
Example #26
Source File: ConfigTest.java    From dubbox with Apache License 2.0 4 votes vote down vote up
@Test
public void testAppendFilter() throws Exception {
    ProviderConfig provider = new ProviderConfig();
    provider.setFilter("classloader,monitor");
    ServiceConfig<DemoService> service = new ServiceConfig<DemoService>();
    service.setFilter("accesslog,trace");
    service.setProvider(provider);
    service.setProtocol(new ProtocolConfig("dubbo", 20880));
    service.setApplication(new ApplicationConfig("provider"));
    service.setRegistry(new RegistryConfig(RegistryConfig.NO_AVAILABLE));
    service.setInterface(DemoService.class);
    service.setRef(new DemoServiceImpl());
    try {
        service.export();
        List<URL> urls = service.toUrls();
        assertNotNull(urls);
        assertEquals(1, urls.size());
        assertEquals("classloader,monitor,accesslog,trace", urls.get(0).getParameter("service.filter"));
        
        ConsumerConfig consumer = new ConsumerConfig();
        consumer.setFilter("classloader,monitor");
        ReferenceConfig<DemoService> reference = new ReferenceConfig<DemoService>();
        reference.setFilter("accesslog,trace");
        reference.setConsumer(consumer);
        reference.setApplication(new ApplicationConfig("consumer"));
        reference.setRegistry(new RegistryConfig(RegistryConfig.NO_AVAILABLE));
        reference.setInterface(DemoService.class);
        reference.setUrl("dubbo://" + NetUtils.getLocalHost() + ":20880?" + DemoService.class.getName() + "?check=false");
        try {
            reference.get();
            urls = reference.toUrls();
            assertNotNull(urls);
            assertEquals(1, urls.size());
            assertEquals("classloader,monitor,accesslog,trace", urls.get(0).getParameter("reference.filter"));
        } finally {
            reference.destroy();
        }
    } finally {
        service.unexport();
    }
}
 
Example #27
Source File: ConfigTest.java    From dubbox-hystrix with Apache License 2.0 4 votes vote down vote up
@Test
public void testAppendFilter() throws Exception {
    ProviderConfig provider = new ProviderConfig();
    provider.setFilter("classloader,monitor");
    ServiceConfig<DemoService> service = new ServiceConfig<DemoService>();
    service.setFilter("accesslog,trace");
    service.setProvider(provider);
    service.setProtocol(new ProtocolConfig("dubbo", 20880));
    service.setApplication(new ApplicationConfig("provider"));
    service.setRegistry(new RegistryConfig(RegistryConfig.NO_AVAILABLE));
    service.setInterface(DemoService.class);
    service.setRef(new DemoServiceImpl());
    try {
        service.export();
        List<URL> urls = service.toUrls();
        assertNotNull(urls);
        assertEquals(1, urls.size());
        assertEquals("classloader,monitor,accesslog,trace", urls.get(0).getParameter("service.filter"));
        
        ConsumerConfig consumer = new ConsumerConfig();
        consumer.setFilter("classloader,monitor");
        ReferenceConfig<DemoService> reference = new ReferenceConfig<DemoService>();
        reference.setFilter("accesslog,trace");
        reference.setConsumer(consumer);
        reference.setApplication(new ApplicationConfig("consumer"));
        reference.setRegistry(new RegistryConfig(RegistryConfig.NO_AVAILABLE));
        reference.setInterface(DemoService.class);
        reference.setUrl("dubbo://" + NetUtils.getLocalHost() + ":20880?" + DemoService.class.getName() + "?check=false");
        try {
            reference.get();
            urls = reference.toUrls();
            assertNotNull(urls);
            assertEquals(1, urls.size());
            assertEquals("classloader,monitor,accesslog,trace", urls.get(0).getParameter("reference.filter"));
        } finally {
            reference.destroy();
        }
    } finally {
        service.unexport();
    }
}
 
Example #28
Source File: ConfigTest.java    From dubbo-2.6.5 with Apache License 2.0 4 votes vote down vote up
@Test
public void testAppendFilter() throws Exception {
    ProviderConfig provider = new ProviderConfig();
    provider.setFilter("classloader,monitor");
    ServiceConfig<DemoService> service = new ServiceConfig<DemoService>();
    service.setFilter("accesslog,trace");
    service.setProvider(provider);
    service.setProtocol(new ProtocolConfig("dubbo", 20880));
    service.setApplication(new ApplicationConfig("provider"));
    service.setRegistry(new RegistryConfig(RegistryConfig.NO_AVAILABLE));
    service.setInterface(DemoService.class);
    service.setRef(new DemoServiceImpl());
    try {
        service.export();
        List<URL> urls = service.toUrls();
        assertNotNull(urls);
        assertEquals(1, urls.size());
        assertEquals("classloader,monitor,accesslog,trace", urls.get(0).getParameter("service.filter"));

        ConsumerConfig consumer = new ConsumerConfig();
        consumer.setFilter("classloader,monitor");
        ReferenceConfig<DemoService> reference = new ReferenceConfig<DemoService>();
        reference.setFilter("accesslog,trace");
        reference.setConsumer(consumer);
        reference.setApplication(new ApplicationConfig("consumer"));
        reference.setRegistry(new RegistryConfig(RegistryConfig.NO_AVAILABLE));
        reference.setInterface(DemoService.class);
        reference.setUrl("dubbo://" + NetUtils.getLocalHost() + ":20880?" + DemoService.class.getName() + "?check=false");
        try {
            reference.get();
            urls = reference.toUrls();
            assertNotNull(urls);
            assertEquals(1, urls.size());
            assertEquals("classloader,monitor,accesslog,trace", urls.get(0).getParameter("reference.filter"));
        } finally {
            reference.destroy();
        }
    } finally {
        service.unexport();
    }
}
 
Example #29
Source File: ConfigTest.java    From dubbox with Apache License 2.0 4 votes vote down vote up
@Test
public void testAppendFilter() throws Exception {
    ProviderConfig provider = new ProviderConfig();
    provider.setFilter("classloader,monitor");
    ServiceConfig<DemoService> service = new ServiceConfig<DemoService>();
    service.setFilter("accesslog,trace");
    service.setProvider(provider);
    service.setProtocol(new ProtocolConfig("dubbo", 20880));
    service.setApplication(new ApplicationConfig("provider"));
    service.setRegistry(new RegistryConfig(RegistryConfig.NO_AVAILABLE));
    service.setInterface(DemoService.class);
    service.setRef(new DemoServiceImpl());
    try {
        service.export();
        List<URL> urls = service.toUrls();
        assertNotNull(urls);
        assertEquals(1, urls.size());
        assertEquals("classloader,monitor,accesslog,trace", urls.get(0).getParameter("service.filter"));
        
        ConsumerConfig consumer = new ConsumerConfig();
        consumer.setFilter("classloader,monitor");
        ReferenceConfig<DemoService> reference = new ReferenceConfig<DemoService>();
        reference.setFilter("accesslog,trace");
        reference.setConsumer(consumer);
        reference.setApplication(new ApplicationConfig("consumer"));
        reference.setRegistry(new RegistryConfig(RegistryConfig.NO_AVAILABLE));
        reference.setInterface(DemoService.class);
        reference.setUrl("dubbo://" + NetUtils.getLocalHost() + ":20880?" + DemoService.class.getName() + "?check=false");
        try {
            reference.get();
            urls = reference.toUrls();
            assertNotNull(urls);
            assertEquals(1, urls.size());
            assertEquals("classloader,monitor,accesslog,trace", urls.get(0).getParameter("reference.filter"));
        } finally {
            reference.destroy();
        }
    } finally {
        service.unexport();
    }
}
 
Example #30
Source File: DubboProperties.java    From spring-boot-starter-dubbo with Apache License 2.0 4 votes vote down vote up
public ProviderConfig getProvider() {
	return provider;
}