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. 【Python】解决Python脚本 在cmd命令行窗口运行时,中文乱码问题

    问题描述 python2.X,代码中指定了UTF-8,但是在cmd命令行窗口时,打印的中文仍然会乱码 在python3不存在该问题 运行结果: 原因 搜索得知,中文windows默认的输出编码为gbk ...

  2. php给图片添加圆角并且保持透明,可做圆形头像

      原文链接:https://www.zhaokeli.com/article/8031.html 给图片添加圆角, 用到的主要的(判断一个点是否在圆内)的公式在上面所说的生成圆形图片文章中. 然后扫 ...

  3. 解决Tomcat加载时报APR错的问题

    部署Tomcat的时候出现了如下错误, INFO: The APR based Apache Tomcat Native library which allows optimal performanc ...

  4. python sort与sorted使用笔记

    Python list内置sort()方法用来排序,也可以用python内置的全局sorted()方法来对可迭代的序列排序生成新的序列 一,最简单的排序 1.使用sort排序 my_list = [3 ...

  5. IOS-源代码管理工具(SVN)

    一.使用环境 要想利用SVN管理源代码,必须得有2套环境 服务器 用于存储客户端上传的源代码 可以在Windows上安装Visual SVN Server 大部分情况下,公司的开发人员不必亲自搭建SV ...

  6. my.cnf 参数说明

    [mysql] prompt="\\u@\\h:\p  \\R:\\m:\\s [\\d]>"  The prompt command reconfigures the de ...

  7. MyCat入门指南

    入门篇 1.       安装 1.1从https://github.com/MyCATApache/Mycat-download下载压缩包 1.2解压缩后复制到相应目录下面,比如/usr/local ...

  8. 【zznu-2060】 Minsum Plus(最小正子段和)

    题目描述 题意简单到令人发指! 序列A由N个整数组成,从中选出一个连续的子序列,使得这个子序列的和为正数,且和为所有和大于零的子序列中的最小值. 将这个值输出,若无解,输出no solution. 输 ...

  9. sql 日志统计-日、周、月活跃数

    近日网站需求:统计日志表的 日.周.月活跃数.最终研究了出来了,分享给大家看下.  如果有更好的sql语句也可以评论下方. --日活跃量 ), cr.AddTime, )as addtimt,COUN ...

  10. 初次使用Quartus II 13.0的疑惑及解决方法

    初次接触Quartus II 13.0,遇到了很多的问题,把问题总结如下: 1.Quartus II 13.0的安装及破解 下载地址:http://t.cn/Rh2TFcz,密码是:g3gc (参考贴 ...