Dubbo:application的配置项
【一】:配置项

<dubbo:application name="服务名字" owner="拥有者" organization="组织名(BU或部门)"/>

【二】:配置解析器
-->具体解析器为com.alibaba.dubbo.config.spring.schema.DubboNamespaceHandler配置的com.alibaba.dubbo.config.spring.schema.DubboBeanDefinitionParser、

【三】:配置目标
--->这个配置会向IOC容器中注册一个bean,该class为com.alibaba.dubbo.config.ApplicationConfig
--->这个bean描述当前项目向注册中心注册的信息的。
--->描述的属性:id,name(应用名字),version(模块版本),owner(应用负责人),organization(组织名和部门),architecture(分层),environment(运行环境),compiler(java编译器),logger(日志输出方式),registries(注册中心),monitor(服务监控),isDefault(是否缺省)

【四】:类

/*
* Copyright 1999-2011 Alibaba Group.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.dubbo.config; import java.util.ArrayList;
import java.util.List; import com.alibaba.dubbo.common.Constants;
import com.alibaba.dubbo.common.compiler.support.AdaptiveCompiler;
import com.alibaba.dubbo.common.logger.LoggerFactory;
import com.alibaba.dubbo.config.support.Parameter; /**
* ApplicationConfig
*
* @author william.liangf
* @export
*/
public class ApplicationConfig extends AbstractConfig { private static final long serialVersionUID = 5508512956753757169L; // 应用名称
private String name; // 模块版本
private String version; // 应用负责人
private String owner; // 组织名(BU或部门)
private String organization; // 分层
private String architecture; // 环境,如:dev/test/run
private String environment; // Java代码编译器
private String compiler; // 日志输出方式
private String logger; // 注册中心
private List<RegistryConfig> registries; // 服务监控
private MonitorConfig monitor; // 是否为缺省
private Boolean isDefault; public ApplicationConfig() {
} public ApplicationConfig(String name) {
setName(name);
} @Parameter(key = Constants.APPLICATION_KEY, required = true)
public String getName() {
return name;
} public void setName(String name) {
checkName("name", name);
this.name = name;
if (id == null || id.length() == 0) {
id = name;
}
} @Parameter(key = "application.version")
public String getVersion() {
return version;
} public void setVersion(String version) {
this.version = version;
} public String getOwner() {
return owner;
} public void setOwner(String owner) {
checkMultiName("owner", owner);
this.owner = owner;
} public String getOrganization() {
return organization;
} public void setOrganization(String organization) {
checkName("organization", organization);
this.organization = organization;
} public String getArchitecture() {
return architecture;
} public void setArchitecture(String architecture) {
checkName("architecture", architecture);
this.architecture = architecture;
} public String getEnvironment() {
return environment;
} public void setEnvironment(String environment) {
checkName("environment", environment);
if(environment != null) {
if (! ("develop".equals(environment) || "test".equals(environment) || "product".equals(environment))) {
throw new IllegalStateException("Unsupported environment: " + environment + ", only support develop/test/product, default is product.");
}
}
this.environment = environment;
} public RegistryConfig getRegistry() {
return registries == null || registries.size() == 0 ? null : registries.get(0);
} public void setRegistry(RegistryConfig registry) {
List<RegistryConfig> registries = new ArrayList<RegistryConfig>(1);
registries.add(registry);
this.registries = registries;
} public List<RegistryConfig> getRegistries() {
return registries;
} @SuppressWarnings({ "unchecked" })
public void setRegistries(List<? extends RegistryConfig> registries) {
this.registries = (List<RegistryConfig>)registries;
} public MonitorConfig getMonitor() {
return monitor;
} public void setMonitor(MonitorConfig monitor) {
this.monitor = monitor;
} public void setMonitor(String monitor) {
this.monitor = new MonitorConfig(monitor);
} public String getCompiler() {
return compiler;
} public void setCompiler(String compiler) {
this.compiler = compiler;
AdaptiveCompiler.setDefaultCompiler(compiler);
} public String getLogger() {
return logger;
} public void setLogger(String logger) {
this.logger = logger;
LoggerFactory.setLoggerAdapter(logger);
} public Boolean isDefault() {
return isDefault;
} public void setDefault(Boolean isDefault) {
this.isDefault = isDefault;
} }

【DUBBO】dobbo的application的配置项的更多相关文章

  1. Dubbo简单DEMO以及重要配置项

    DEMO pom.xml 消费方和服务提供方一致 <properties> <spring.version>4.0.6.RELEASE</spring.version&g ...

  2. 附录A application.properties配置项

    摘自官网,仅作为参考用 Part X. Appendices # =================================================================== ...

  3. SpringBoot application.properties 配置项详解

    参考: http://blog.csdn.net/lpfsuperman/article/details/78287265### # spring boot application.propertie ...

  4. Dubbo配置注册中心设置application的name使用驼峰命名法存在的隐藏项目启动异常问题

    原创/朱季谦 首先,先提一个建议,在SpringBoot+Dubbo项目中,Dubbo配置注册中心设置的application命名name的值,最好使用xxx-xxx-xxx这样格式的,避免随便使用驼 ...

  5. Dubbo(二) —— dubbo配置

      一.配置原则 JVM 启动 -D 参数优先,这样可以使用户在部署和启动时进行参数重写,比如在启动时需改变协议的端口. XML 次之,如果在 XML 中有配置,则 dubbo.properties ...

  6. dubbo在idea下的使用创建 服务者,消费者 注册中心

    1.基于windows 下  spring 下的dubbo  需要书写配置文件 (1).创建带有web工程的项目 创建一个服务者 package cn.edu.aynu.bean; import lo ...

  7. Dubbo 源码分析 - 服务导出

    1.服务导出过程 本篇文章,我们来研究一下 Dubbo 导出服务的过程.Dubbo 服务导出过程始于 Spring 容器发布刷新事件,Dubbo 在接收到事件后,会立即执行服务导出逻辑.整个逻辑大致可 ...

  8. dubbo系列五、dubbo核心配置

    一.配置文件 1.生产者配置provider.xml <?xml version="1.0" encoding="UTF-8"?> <bean ...

  9. dubbo超时优先级设置

    调用超时配置的优先级 可以在多个配置项设置超时,由上至下覆盖(即上面的优先),示例如下: # 其它的参数(retries.loadbalance.actives等)的覆盖策略也一样. 提供者端特定方法 ...

随机推荐

  1. [Vue]使用axios实现ajax请求

    1.定义myAjax export const myAjax=function createHttpClient(ajaxConfig) {   let httpClient = null;   if ...

  2. [javascript]Dom操作笔记

    1.为一个节点同时设置多个属性 $("div[aria-describedby='F53_batch_history']").attr({"display":& ...

  3. Android6.0------权限申请RxPermissions

    前面写了Android6.0权限介绍和权限单个,多个申请,用的是纯Java代码,本文主要说的是借助第三方库来实现权限申请. 借助第三方库 RxPermissions来申请6.0权限. RxPermis ...

  4. linux杀毒软件clamav安装与使用

    #clamav安装与使用 ###第一步:Clamav下载http://www.clamav.net/downloads wget http://www.clamav.net/downloads/pro ...

  5. Day34 设计模式

    参考博客: http://www.cnblogs.com/alex3714/articles/5760582.html 什么是设计模式 Christopher Alexander:“每一个模式描述了一 ...

  6. 上下行分流下行负载方式和能ping通但不能打开

    1 下行线路负载方式选择  目的端口+协议  否则有可能出现微信443端口图片打不开的情况. 2.彭ping通但是打不开的情况下将上行线路mtu值改小 由1500改为1450

  7. IHTMLDocument2 TO IWebBrowser2

    if(NULL != pIHTMLDocument2) { IHTMLWindow2* pIHTMLWindow2 = NULL; hr = pIHTMLDocument2->get_paren ...

  8. Winform 导航菜单的方法

    http://blog.163.com/kunkun0921@126/blog/static/169204332201171610619611/ 第一种:使用OutlookBar第三方控件 第二种:使 ...

  9. CentOS 6.5 升级内核到 3.10.28

    本文适用于CentOS 6.4, CentOS 6.5,亲测可行,估计也适用于其他Linux发行版. 1. 准备工作 1.1 下载源码包 Linux内核版本有两种:稳定版和开发版 ,Linux内核版本 ...

  10. C#学习历程(九)[类的定义与声明]

    一.C#中类的声明 在C#中必须先声明类,然后才能在程序中使用. 类的声明格式如下: [类的属性] [访问修饰符] class 类名称 [: 父类名]{    [成员修饰符] 类的成员变量或者成员函数 ...