分布式架构学习之:003--使用Dubbo进行规模服务化前的工程结构优化

来源:互联网 发布:赛尔网络是国企吗 编辑:程序博客网 时间:2024/06/05 10:12

一、使用Dubbo是为了实现系统的分布式服务化

二、使用分布式服务的特点:

        1、多个服务(每个服务单独成立)

        2、多种类型的工程(公共工程、服务工程、定时任务工程、Web工程、普通jar工程...)

        3、工程间相互调用(MQ)

        4、如何做到工程间解耦(高内聚、低耦合)

        5、工程该如何拆分

        6、如何对大量工程进行有效管理(持续集成)


edu-common-parent是所有common工程的父工程,主要声明所有工程的版本号,jar包管理。


pom文件为:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"><modelVersion>4.0.0</modelVersion><groupId>wusc.edu.common</groupId><artifactId>edu-common-parent</artifactId><version>1.0-SNAPSHOT</version><packaging>pom</packaging><name>edu-common-parent</name><url>http://maven.apache.org</url><distributionManagement><repository><id>nexus-releases</id><name>Nexus Release Repository</name><url>http://192.168.100.66:8081/nexus/content/repositories/releases/</url></repository><snapshotRepository><id>nexus-snapshots</id><name>Nexus Snapshot Repository</name><url>http://192.168.100.66:8081/nexus/content/repositories/snapshots/</url></snapshotRepository></distributionManagement><properties><project.build.sourceEncoding>UTF-8</project.build.sourceEncoding><!-- common projects --><edu-common.version>1.0-SNAPSHOT</edu-common.version><edu-common-config.version>1.0-SNAPSHOT</edu-common-config.version><edu-common-core.version>1.0-SNAPSHOT</edu-common-core.version><edu-common-web.version>1.0-SNAPSHOT</edu-common-web.version><edu-demo.version>1.0-SNAPSHOT</edu-demo.version><!-- facade projects --><edu-facade-user.version>1.0-SNAPSHOT</edu-facade-user.version><!-- service projects --><edu-service-user.version>1.0-SNAPSHOT</edu-service-user.version><!-- web projects --><edu-web-boss.version>1.0-SNAPSHOT</edu-web-boss.version><!-- app projects --><!-- timer projects --><!-- frameworks --><org.springframework.version>3.2.4.RELEASE</org.springframework.version><org.apache.struts.version>2.3.15.1</org.apache.struts.version></properties><dependencies><!-- Test Dependency Begin --><dependency><groupId>junit</groupId><artifactId>junit</artifactId><version>4.11</version></dependency><!-- Test Dependency End --></dependencies><dependencyManagement><dependencies><!-- Common Dependency Begin --><dependency><groupId>xalan</groupId><artifactId>xalan</artifactId><version>2.7.1</version></dependency><dependency><groupId>antlr</groupId><artifactId>antlr</artifactId><version>2.7.6</version></dependency><dependency><groupId>aopalliance</groupId><artifactId>aopalliance</artifactId><version>1.0</version></dependency><dependency><groupId>org.aspectj</groupId><artifactId>aspectjweaver</artifactId><version>1.7.3</version></dependency><dependency><groupId>cglib</groupId><artifactId>cglib</artifactId><version>2.2.2</version></dependency><dependency><groupId>asm</groupId><artifactId>asm</artifactId><version>3.3.1</version></dependency><dependency><groupId>net.sf.json-lib</groupId><artifactId>json-lib</artifactId><version>2.3</version><classifier>jdk15</classifier><scope>compile</scope></dependency><dependency><groupId>org.codehaus.jackson</groupId><artifactId>jackson-core-asl</artifactId><version>1.9.13</version></dependency><dependency><groupId>org.codehaus.jackson</groupId><artifactId>jackson-mapper-asl</artifactId><version>1.9.13</version></dependency><dependency><groupId>ognl</groupId><artifactId>ognl</artifactId><version>3.0.6</version></dependency><dependency><groupId>oro</groupId><artifactId>oro</artifactId><version>2.0.8</version></dependency><dependency><groupId>commons-net</groupId><artifactId>commons-net</artifactId><version>3.2</version></dependency><dependency><groupId>commons-beanutils</groupId><artifactId>commons-beanutils</artifactId><version>1.8.0</version></dependency><dependency><groupId>commons-codec</groupId><artifactId>commons-codec</artifactId><version>1.8</version></dependency><dependency><groupId>commons-collections</groupId><artifactId>commons-collections</artifactId><version>3.2</version></dependency><dependency><groupId>commons-digester</groupId><artifactId>commons-digester</artifactId><version>2.0</version></dependency><dependency><groupId>commons-fileupload</groupId><artifactId>commons-fileupload</artifactId><version>1.3.1</version></dependency><dependency><groupId>commons-io</groupId><artifactId>commons-io</artifactId><version>2.0.1</version></dependency><dependency><groupId>org.apache.commons</groupId><artifactId>commons-lang3</artifactId><version>3.1</version></dependency><dependency><groupId>commons-logging</groupId><artifactId>commons-logging</artifactId><version>1.1.3</version></dependency><dependency><groupId>commons-validator</groupId><artifactId>commons-validator</artifactId><version>1.1.4</version></dependency><dependency><groupId>commons-cli</groupId><artifactId>commons-cli</artifactId><version>1.2</version></dependency><dependency><groupId>dom4j</groupId><artifactId>dom4j</artifactId><version>1.6.1</version></dependency><dependency><groupId>net.sf.ezmorph</groupId><artifactId>ezmorph</artifactId><version>1.0.6</version></dependency><dependency><groupId>javassist</groupId><artifactId>javassist</artifactId><version>3.12.1.GA</version></dependency><dependency><groupId>jstl</groupId><artifactId>jstl</artifactId><version>1.2</version></dependency><dependency><groupId>javax.transaction</groupId><artifactId>jta</artifactId><version>1.1</version></dependency><dependency><groupId>log4j</groupId><artifactId>log4j</artifactId><version>1.2.17</version></dependency><dependency><groupId>org.slf4j</groupId><artifactId>slf4j-api</artifactId><version>1.7.5</version></dependency><dependency><groupId>org.slf4j</groupId><artifactId>slf4j-log4j12</artifactId><version>1.7.5</version></dependency><dependency><groupId>net.sourceforge.jexcelapi</groupId><artifactId>jxl</artifactId><version>2.6.12</version></dependency><dependency> <groupId>com.alibaba.external</groupId> <artifactId>sourceforge.spring</artifactId> <version>2.0.1</version> </dependency> <dependency> <groupId>com.alibaba.external</groupId> <artifactId>jakarta.commons.poolg</artifactId> <version>1.3</version> </dependency> <dependency><groupId>org.jdom</groupId><artifactId>jdom</artifactId><version>1.1.3</version></dependency><dependency><groupId>jaxen</groupId><artifactId>jaxen</artifactId><version>1.1.1</version></dependency><dependency><groupId>com.alibaba</groupId><artifactId>dubbo</artifactId><version>2.5.3</version></dependency><dependency><groupId>redis.clients</groupId><artifactId>jedis</artifactId><version>2.4.2</version></dependency><!-- Common Dependency End --><!-- Zookeeper 用于分布式服务管理 --><dependency><groupId>org.apache.zookeeper</groupId><artifactId>zookeeper</artifactId><version>3.4.5</version></dependency><dependency><groupId>com.101tec</groupId><artifactId>zkclient</artifactId><version>0.3</version></dependency><!-- Zookeeper 用于分布式服务管理 end --><!-- Spring Dependency Begin --><dependency><groupId>org.springframework</groupId><artifactId>spring-aop</artifactId><version>${org.springframework.version}</version></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-aspects</artifactId><version>${org.springframework.version}</version></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-beans</artifactId><version>${org.springframework.version}</version></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-context</artifactId><version>${org.springframework.version}</version></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-context-support</artifactId><version>${org.springframework.version}</version></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-core</artifactId><version>${org.springframework.version}</version></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-expression</artifactId><version>${org.springframework.version}</version></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-instrument</artifactId><version>${org.springframework.version}</version></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-instrument-tomcat</artifactId><version>${org.springframework.version}</version></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-jdbc</artifactId><version>${org.springframework.version}</version></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-jms</artifactId><version>${org.springframework.version}</version></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-orm</artifactId><version>${org.springframework.version}</version></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-oxm</artifactId><version>${org.springframework.version}</version></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-struts</artifactId><version>${org.springframework.version}</version></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-test</artifactId><version>${org.springframework.version}</version><scope>test</scope></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-tx</artifactId><version>${org.springframework.version}</version></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-web</artifactId><version>${org.springframework.version}</version></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-webmvc</artifactId><version>${org.springframework.version}</version></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-webmvc-portlet</artifactId><version>${org.springframework.version}</version></dependency><!-- Spring Dependency End --><!-- MyBatis Dependency Begin --><dependency><groupId>org.mybatis</groupId><artifactId>mybatis</artifactId><version>3.2.2</version></dependency><dependency><groupId>org.mybatis</groupId><artifactId>mybatis-spring</artifactId><version>1.2.0</version></dependency><!-- MyBatis Dependency End --><!-- Mysql Driver Begin --><dependency><groupId>mysql</groupId><artifactId>mysql-connector-java</artifactId><version>5.1.32</version></dependency><!-- Mysql Driver End --><!-- Struts2 Dependency Begin --><dependency><groupId>org.apache.struts</groupId><artifactId>struts2-json-plugin</artifactId><version>${org.apache.struts.version}</version></dependency><dependency><groupId>org.apache.struts</groupId><artifactId>struts2-convention-plugin</artifactId><version>${org.apache.struts.version}</version></dependency><dependency><groupId>org.apache.struts</groupId><artifactId>struts2-core</artifactId><version>${org.apache.struts.version}</version></dependency><dependency><groupId>org.apache.struts</groupId><artifactId>struts2-spring-plugin</artifactId><version>${org.apache.struts.version}</version></dependency><dependency><groupId>org.apache.struts.xwork</groupId><artifactId>xwork-core</artifactId><version>${org.apache.struts.version}</version></dependency><!-- Struts2 Dependency End --><!-- Others Begin --><dependency><groupId>google.code</groupId><artifactId>kaptcha</artifactId><version>2.3.2</version></dependency><dependency><groupId>org.apache.tomcat</groupId><artifactId>servlet-api</artifactId><version>6.0.37</version></dependency><dependency><groupId>org.apache.tomcat</groupId><artifactId>jsp-api</artifactId><version>6.0.37</version></dependency><dependency><groupId>org.freemarker</groupId><artifactId>freemarker</artifactId><version>2.3.19</version></dependency><dependency><groupId>com.alibaba</groupId><artifactId>druid</artifactId><version>0.2.23</version></dependency><dependency><groupId>com.alibaba</groupId><artifactId>fastjson</artifactId><version>1.1.41</version></dependency><dependency><groupId>org.apache.httpcomponents</groupId><artifactId>httpclient</artifactId><version>4.3.3</version></dependency><dependency><groupId>org.jboss.netty</groupId><artifactId>netty</artifactId><version>3.2.5.Final</version></dependency><dependency><groupId>org.apache.activemq</groupId><artifactId>activemq-all</artifactId><version>5.8.0</version></dependency><dependency><groupId>org.apache.activemq</groupId><artifactId>activemq-pool</artifactId><version>5.8.0</version></dependency><!-- Others End --><dependency><groupId>org.jsoup</groupId><artifactId>jsoup</artifactId><version>1.7.3</version></dependency></dependencies></dependencyManagement><build><plugins><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-deploy-plugin</artifactId><version>2.7</version><configuration><uniqueVersion>false</uniqueVersion></configuration></plugin><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-eclipse-plugin</artifactId><version>2.8</version></plugin><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-compiler-plugin</artifactId><version>2.3.2</version><configuration><failOnError>true</failOnError><verbose>true</verbose><fork>true</fork><compilerArgument>-nowarn</compilerArgument><source>1.6</source><target>1.6</target><encoding>UTF-8</encoding></configuration></plugin><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-source-plugin</artifactId><version>2.1.2</version><executions><execution><id>attach-sources</id><goals><goal>jar</goal></goals></execution></executions></plugin></plugins></build></project>

edu-common工程是所有工程的公共部分,如异常、page、枚举、工具类、常量等


<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"><modelVersion>4.0.0</modelVersion><parent><groupId>wusc.edu.common</groupId><artifactId>edu-common-parent</artifactId><version>1.0-SNAPSHOT</version><relativePath>../edu-common-parent</relativePath></parent><artifactId>edu-common</artifactId><version>${edu-common.version}</version><packaging>jar</packaging><name>edu-common</name><url>http://maven.apache.org</url><properties><project.build.sourceEncoding>UTF-8</project.build.sourceEncoding></properties><dependencies></dependencies></project>


edu-common-config是所有工程的公共配置,如jdbc、注册中心配置、MQ配置等

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"><modelVersion>4.0.0</modelVersion><parent><groupId>wusc.edu.common</groupId><artifactId>edu-common-parent</artifactId><version>1.0-SNAPSHOT</version><relativePath>../edu-common-parent</relativePath></parent><artifactId>edu-common-config</artifactId><version>${edu-common-config.version}</version><packaging>jar</packaging><name>edu-common-config</name><url>http://maven.apache.org</url><properties><project.build.sourceEncoding>UTF-8</project.build.sourceEncoding></properties><build><finalName>edu-common-config</finalName><resources><!-- 指定 src/main/resources下所有文件及文件夹为资源文件 --><resource><directory>src/main/resources</directory><targetPath>${project.build.directory}/classes</targetPath><includes><include>**/*</include></includes><filtering>true</filtering></resource></resources></build></project>

edu-common-core是所有工程的公共方法等,如BaseDao等,并且在pom中应用所有的jar包。

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"><modelVersion>4.0.0</modelVersion><parent><groupId>wusc.edu.common</groupId><artifactId>edu-common-parent</artifactId><version>1.0-SNAPSHOT</version><relativePath>../edu-common-parent</relativePath></parent><artifactId>edu-common-core</artifactId><version>${edu-common-core.version}</version><packaging>jar</packaging><name>edu-common-core</name><url>http://maven.apache.org</url><properties><project.build.sourceEncoding>UTF-8</project.build.sourceEncoding></properties><dependencies><dependency><groupId>wusc.edu.common</groupId><artifactId>edu-common</artifactId><version>${edu-common.version}</version></dependency><dependency><groupId>log4j</groupId><artifactId>log4j</artifactId></dependency><dependency><groupId>org.slf4j</groupId><artifactId>slf4j-api</artifactId></dependency><dependency><groupId>org.slf4j</groupId><artifactId>slf4j-log4j12</artifactId></dependency><!-- Spring Dependency Begin --><dependency><groupId>org.springframework</groupId><artifactId>spring-aop</artifactId></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-aspects</artifactId></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-beans</artifactId></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-context</artifactId></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-context-support</artifactId></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-core</artifactId></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-instrument</artifactId></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-instrument-tomcat</artifactId></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-jdbc</artifactId></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-jms</artifactId></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-orm</artifactId></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-oxm</artifactId></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-test</artifactId><scope>test</scope></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-tx</artifactId></dependency><!-- Spring Dependency End --><!-- MyBatis Dependency Begin --><dependency><groupId>org.mybatis</groupId><artifactId>mybatis</artifactId></dependency><dependency><groupId>org.mybatis</groupId><artifactId>mybatis-spring</artifactId></dependency><!-- MyBatis Dependency End --></dependencies></project>

edu-common-web是所有web工程,如门户、后台管理等的公共部分,如ActionSupport


<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"><modelVersion>4.0.0</modelVersion><parent><groupId>wusc.edu.common</groupId><artifactId>edu-common-parent</artifactId><version>1.0-SNAPSHOT</version><relativePath>../edu-common-parent</relativePath></parent><artifactId>edu-common-web</artifactId><version>${edu-common-web.version}</version><packaging>jar</packaging><name>edu-common-web</name><url>http://maven.apache.org</url><properties><project.build.sourceEncoding>UTF-8</project.build.sourceEncoding></properties><dependencies><dependency><groupId>wusc.edu.common</groupId><artifactId>edu-common</artifactId><version>${edu-common.version}</version></dependency><dependency><groupId>org.apache.tomcat</groupId><artifactId>servlet-api</artifactId><scope>provided</scope></dependency><dependency><groupId>org.apache.tomcat</groupId><artifactId>jsp-api</artifactId><scope>provided</scope></dependency><dependency><groupId>commons-beanutils</groupId><artifactId>commons-beanutils</artifactId></dependency><dependency><groupId>commons-codec</groupId><artifactId>commons-codec</artifactId></dependency><dependency><groupId>commons-collections</groupId><artifactId>commons-collections</artifactId></dependency><dependency><groupId>commons-digester</groupId><artifactId>commons-digester</artifactId></dependency><dependency><groupId>commons-fileupload</groupId><artifactId>commons-fileupload</artifactId></dependency><dependency><groupId>commons-io</groupId><artifactId>commons-io</artifactId></dependency><dependency><groupId>org.apache.commons</groupId><artifactId>commons-lang3</artifactId></dependency><dependency><groupId>commons-logging</groupId><artifactId>commons-logging</artifactId></dependency><dependency><groupId>commons-validator</groupId><artifactId>commons-validator</artifactId></dependency><!-- Struts2 Dependency Begin --><dependency><groupId>org.apache.struts</groupId><artifactId>struts2-json-plugin</artifactId></dependency><dependency><groupId>org.apache.struts</groupId><artifactId>struts2-convention-plugin</artifactId></dependency><dependency><groupId>org.apache.struts</groupId><artifactId>struts2-core</artifactId></dependency><dependency><groupId>org.apache.struts</groupId><artifactId>struts2-spring-plugin</artifactId></dependency><dependency><groupId>org.apache.struts.xwork</groupId><artifactId>xwork-core</artifactId></dependency><!-- Struts2 Dependency End --></dependencies></project>

edu-facade-user是用户接口,供服务提供者和服务消费者引用


<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"><modelVersion>4.0.0</modelVersion><parent><groupId>wusc.edu.common</groupId><artifactId>edu-common-parent</artifactId><version>1.0-SNAPSHOT</version><relativePath>../edu-common-parent</relativePath></parent><groupId>wusc.edu.facade</groupId><artifactId>edu-facade-user</artifactId><version>${edu-facade-user.version}</version><packaging>jar</packaging><name>edu-facade-user</name><url>http://maven.apache.org</url><properties><project.build.sourceEncoding>UTF-8</project.build.sourceEncoding></properties><dependencies><dependency><groupId>wusc.edu.common</groupId><artifactId>edu-common</artifactId><version>${edu-common.version}</version></dependency></dependencies></project>

服务提供者edu-service-user


pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"><modelVersion>4.0.0</modelVersion><parent><groupId>wusc.edu.common</groupId><artifactId>edu-common-parent</artifactId><version>1.0-SNAPSHOT</version><relativePath>../edu-common-parent</relativePath></parent><groupId>wusc.edu.service</groupId><artifactId>edu-service-user</artifactId><version>${edu-service-user.version}</version><packaging>jar</packaging><name>edu-service-user</name><url>http://maven.apache.org</url><properties><project.build.sourceEncoding>UTF-8</project.build.sourceEncoding><log4j.leve>debug</log4j.leve><log4j.ale>debug</log4j.ale></properties><build><finalName>edu-service-user</finalName><resources><resource><targetPath>${project.build.directory}/classes</targetPath><directory>src/main/resources</directory><filtering>true</filtering><includes><include>**/*.xml</include><include>**/*.properties</include></includes></resource></resources></build><dependencies><dependency><groupId>wusc.edu.common</groupId><artifactId>edu-common</artifactId><version>${edu-common.version}</version></dependency><dependency><groupId>wusc.edu.common</groupId><artifactId>edu-common-config</artifactId><version>${edu-common-config.version}</version></dependency><dependency><groupId>wusc.edu.common</groupId><artifactId>edu-common-core</artifactId><version>${edu-common-core.version}</version></dependency><dependency><groupId>wusc.edu.facade</groupId><artifactId>edu-facade-user</artifactId><version>${edu-facade-user.version}</version></dependency><!-- Common Dependency Begin --><dependency><groupId>antlr</groupId><artifactId>antlr</artifactId></dependency><dependency><groupId>aopalliance</groupId><artifactId>aopalliance</artifactId></dependency><dependency><groupId>org.aspectj</groupId><artifactId>aspectjweaver</artifactId></dependency><dependency><groupId>cglib</groupId><artifactId>cglib</artifactId></dependency><dependency><groupId>net.sf.json-lib</groupId><artifactId>json-lib</artifactId><classifier>jdk15</classifier><scope>compile</scope></dependency><dependency><groupId>ognl</groupId><artifactId>ognl</artifactId></dependency><dependency><groupId>oro</groupId><artifactId>oro</artifactId></dependency><dependency><groupId>commons-beanutils</groupId><artifactId>commons-beanutils</artifactId></dependency><dependency><groupId>commons-codec</groupId><artifactId>commons-codec</artifactId></dependency><dependency><groupId>commons-collections</groupId><artifactId>commons-collections</artifactId></dependency><dependency><groupId>commons-digester</groupId><artifactId>commons-digester</artifactId></dependency><dependency><groupId>commons-fileupload</groupId><artifactId>commons-fileupload</artifactId></dependency><dependency><groupId>commons-io</groupId><artifactId>commons-io</artifactId></dependency><dependency><groupId>org.apache.commons</groupId><artifactId>commons-lang3</artifactId></dependency><dependency><groupId>commons-logging</groupId><artifactId>commons-logging</artifactId></dependency><dependency><groupId>commons-validator</groupId><artifactId>commons-validator</artifactId></dependency><dependency><groupId>dom4j</groupId><artifactId>dom4j</artifactId></dependency><dependency><groupId>net.sf.ezmorph</groupId><artifactId>ezmorph</artifactId></dependency><dependency><groupId>javassist</groupId><artifactId>javassist</artifactId></dependency><dependency><groupId>jstl</groupId><artifactId>jstl</artifactId></dependency><dependency><groupId>javax.transaction</groupId><artifactId>jta</artifactId></dependency><dependency><groupId>log4j</groupId><artifactId>log4j</artifactId></dependency><dependency><groupId>org.slf4j</groupId><artifactId>slf4j-api</artifactId></dependency><dependency><groupId>org.slf4j</groupId><artifactId>slf4j-log4j12</artifactId></dependency><!-- Common Dependency End --><!-- Spring Dependency Begin --><dependency><groupId>org.springframework</groupId><artifactId>spring-aop</artifactId></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-aspects</artifactId></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-beans</artifactId></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-context</artifactId></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-context-support</artifactId></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-core</artifactId></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-expression</artifactId></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-instrument</artifactId></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-instrument-tomcat</artifactId></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-jdbc</artifactId></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-jms</artifactId></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-orm</artifactId></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-oxm</artifactId></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-struts</artifactId></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-test</artifactId><scope>test</scope></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-tx</artifactId></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-web</artifactId></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-webmvc</artifactId></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-webmvc-portlet</artifactId></dependency><!-- Spring Dependency End --><!-- MyBatis Dependency Begin --><dependency><groupId>org.mybatis</groupId><artifactId>mybatis</artifactId></dependency><dependency><groupId>org.mybatis</groupId><artifactId>mybatis-spring</artifactId></dependency><!-- MyBatis Dependency End --><!-- Struts2 Dependency Begin --><dependency><groupId>org.apache.struts</groupId><artifactId>struts2-json-plugin</artifactId></dependency><dependency><groupId>org.apache.struts</groupId><artifactId>struts2-convention-plugin</artifactId></dependency><dependency><groupId>org.apache.struts</groupId><artifactId>struts2-core</artifactId></dependency><dependency><groupId>org.apache.struts</groupId><artifactId>struts2-spring-plugin</artifactId></dependency><dependency><groupId>org.apache.struts.xwork</groupId><artifactId>xwork-core</artifactId></dependency><!-- Struts2 Dependency End --><!-- Others Begin --><dependency><groupId>org.apache.tomcat</groupId><artifactId>servlet-api</artifactId><scope>provided</scope></dependency><dependency><groupId>org.apache.tomcat</groupId><artifactId>jsp-api</artifactId><scope>provided</scope></dependency><dependency><groupId>com.alibaba</groupId><artifactId>druid</artifactId></dependency><dependency><groupId>org.jsoup</groupId><artifactId>jsoup</artifactId></dependency><!-- Others End --><!-- Mysql Driver Begin --><dependency><groupId>mysql</groupId><artifactId>mysql-connector-java</artifactId></dependency><!-- Mysql Driver End --><!-- dubbo 需要的jar start --><dependency><groupId>org.jboss.netty</groupId><artifactId>netty</artifactId></dependency><dependency><groupId>com.alibaba</groupId><artifactId>dubbo</artifactId><exclusions><exclusion><groupId>org.springframework</groupId><artifactId>spring</artifactId></exclusion></exclusions></dependency><dependency><groupId>org.apache.zookeeper</groupId><artifactId>zookeeper</artifactId></dependency><dependency><groupId>com.101tec</groupId><artifactId>zkclient</artifactId></dependency><!-- dubbo 需要的jar end --></dependencies></project>


dubbo-provider.xml,在pom中声明引用edu-common-config,就可以直接使用dubbo.registry.address,因为在spring-context中

<!-- 读入配置属性文件 -->
<context:property-placeholder location="classpath:jdbc.properties,classpath:service.properties" />

<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"xsi:schemaLocation="http://www.springframework.org/schema/beans              http://www.springframework.org/schema/beans/spring-beans.xsd              http://code.alibabatech.com/schema/dubbo              http://code.alibabatech.com/schema/dubbo/dubbo.xsd"><!-- 提供方应用信息,用于计算依赖关系 --><dubbo:application name="gw-service-user" /><!-- 使用zookeeper注册中心暴露服务地址 --><dubbo:registry protocol="zookeeper" address="${dubbo.registry.address}" /><!-- 用dubbo协议在20880端口暴露服务 --><dubbo:protocol name="dubbo" port="20880" /><!-- 用户服务接口 --><dubbo:service interface="wusc.edu.facade.user.service.PmsUserFacade" ref="pmsUserFacade" /></beans>  

。。。

0 0
原创粉丝点击