• dubbo.properties&属性加载顺序



    启动时检查默认为true


    超时时间设置




    重试次数

    版本

    配置与SpringBoot整合的三种方式

    3、使用注解API方式

    @Configuration
    public class MyDubboConfig {
    	
    	@Bean
    	public ApplicationConfig applicationConfig() {
    		ApplicationConfig applicationConfig = new ApplicationConfig();
    		applicationConfig.setName("boot-user-service-provider");
    		return applicationConfig;
    	}
    	
    	//<dubbo:registry protocol="zookeeper" address="127.0.0.1:2181"></dubbo:registry>
    	@Bean
    	public RegistryConfig registryConfig() {
    		RegistryConfig registryConfig = new RegistryConfig();
    		registryConfig.setProtocol("zookeeper");
    		registryConfig.setAddress("127.0.0.1:2181");
    		return registryConfig;
    	}
    	
    	//<dubbo:protocol name="dubbo" port="20882"></dubbo:protocol>
    	@Bean
    	public ProtocolConfig protocolConfig() {
    		ProtocolConfig protocolConfig = new ProtocolConfig();
    		protocolConfig.setName("dubbo");
    		protocolConfig.setPort(20882);
    		return protocolConfig;
    	}
    	
    	/**
    	 *<dubbo:service interface="com.atguigu.gmall.service.UserService" 
    		ref="userServiceImpl01" timeout="1000" version="1.0.0">
    		<dubbo:method name="getUserAddressList" timeout="1000"></dubbo:method>
    	</dubbo:service>
    	 */
    	@Bean
    	public ServiceConfig<UserService> userServiceConfig(UserService userService){
    		ServiceConfig<UserService> serviceConfig = new ServiceConfig<>();
    		serviceConfig.setInterface(UserService.class);
    		serviceConfig.setRef(userService);
    		serviceConfig.setVersion("1.0.0");
    		
    		//配置每一个method的信息
    		MethodConfig methodConfig = new MethodConfig();
    		methodConfig.setName("getUserAddressList");
    		methodConfig.setTimeout(1000);
    		
    		//将method的设置关联到service配置中
    		List<MethodConfig> methods = new ArrayList<>();
    		methods.add(methodConfig);
    		serviceConfig.setMethods(methods);
    		
    		//ProviderConfig
    		//MonitorConfig
    		
    		return serviceConfig;
    	}
    
    }
    

  • 相关阅读:
    通过 nginx 搭建一个基于 httpflv 的直播流媒体服务器
    obs+nodemediaserver+flv.js搭建直播流媒体服务器
    跨平台跨架构的统信DTK开发套件教程及常见问题
    如何获取youtube视频的高清封面?
    Flutter路由配置
    调用feign接口新增用户报错xxx is not a type supported by this encoder
    C# 程序动态调用 C/C++ 动态库函数
    ELK部署
    ElasticSearch的常用API
    Microsoft IIS Web服务器配置优化
  • 原文地址:https://www.cnblogs.com/xidianzxm/p/14389338.html
Copyright © 2020-2023  润新知