1 분포
1.1 배포 된 것
1.2 분산과 클러스터의 차이
작은 식당에는 야채를 자르고 야채를 씻고 재료를 준비하고 볶음을하는 작은 식당에는 한 명의 요리사가 있다는 것이 밝혀졌습니다. 나중에 더 많은 고객이 있었고 주방의 요리사가 너무 바빠서 다른 요리사를 고용했습니다. 두 요리사 모두 같은 요리를 요리 할 수 있습니다. 이 두 요리사 사이의 관계는 클러스터였습니다. 요리사가 요리에 집중하고 요리를 최대한 활용하기 위해 야채를 자르고 요리 준비 및 재료 준비를 담당하기 위해 반찬을 고용했습니다. 요리사와 반찬 사이의 관계가 배포되고 하나의 반찬이 너무 바빠서 반찬을 고용했으며 두 반찬의 관계는 클러스터입니다.
2. 분산 프로젝트를 구축하십시오
준비 도구 : Eclipse, Centos7 시스템, Zookeeper가 장착 된 VMwarm .... 가장 중요한 것은 3 살짜리 노인 기계입니다.
1 먼저 부모 클래스의 Maven 프로젝트를 만듭니다. 포장 방법은 POM입니다.
Eclipse에서 부모 클래스 Maven 프로젝트를 만들면 포장 방법이 POM입니다. 부모 클래스 Maven 프로젝트를 만드는 이유는 무엇입니까? 이 Maven 프로젝트를 사용하여 다양한 JAR 패키지 버전을 관리하려면 서브 클래스가 JAR 패키지를 직접 원하고 부모 클래스를 원한다면이를 수행 할 수 있습니다. 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/0.0.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd "> <modelversion> 4.0.0 </modelversion> <groupid> com.itqf </groupid> <artifactid> sing-parent </artifactid> <버전> 0.0.1-snap </version> </packaging> <! 패키지-> <속성> <junit.version> 4.12 </junit.version> <spring.version> 4.2.4. Release </spring.version> <mybatis.version> 3.2.8 </mybatis.version> <mybatis.spring.version> 1.2.2 < /mybatis.spring.version> hallybatis.paginator.version>1.2.15</mybatis.paginator.version> version> hallf4j.version>1.6.4</slf4j.ve RSION> <Jackson.version> 2.4.2 </jackson.version> <druid.version> 1.0.9 </druid.version> <httpclient.version> 4.3.5 </httpclient.version> <jstl.version> 1.2 </jstl .version> <servlet-api.version> 2.5 </servlet-api.version> <jsp-api.version> 2.0 </jsp-api.version> <joda-time.version> 2.5 </joda-time.version> <commons-lang3.ve RSION> 3.3.2 </Commons-lang3.version> <Commons-io.version> 1.3.2 </Commons-io.version> <Commons-Net.version> 3.3 </Commons-Net.version> <pageHelper.version> 3.4. 2-fix </PageHelper.version> <jsqlparser.version> 0.9.1 </jsqlparser.version> <Commons-FileUpload.version> 1.3.1 </Commons-fileupload.version> <jedis.version> 2.7 .2 </jedis.version> <solrj.version> 4.10.3 </solrj.version> <bubbo.version> 2.5.3 </dubbo.version> <keokeeper.version> 3.4.7 </zookeeper.version> <zkclient.versio n> 0.1 </zkclient.version> <activemq.version> 5.11.2 </activemq.version> <freemarker.version> 2.3.23 </freemarker.version> <quartz.version> 2.2.2 </Quartz.version> </properties> <!-실제 종속성없이 모든 프로젝트에 사용되는 JAR 패키지 관리-> <pectionencymanagement> <pectinements> <!-시간 조작 구성 요소-> <pectionency> <groupId> Joda-time </groupId>
2 Maven Aggregation 프로젝트를 만듭니다.
2.1 Maven Aggregation Project를 만들고 부모 프로젝트를 상속받습니다.
집계 엔지니어링 : 컨트롤러 계층, 뷰 계층 등. 프로젝트의 프로젝트에서 프로젝트로 독립적으로 형성 될 수 있으며 마지막으로 프로젝트가 실행될 때 프로젝트에 통합 될 수 있습니다.
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/0.0.0.0 http://maven.apache.org/xsd/maven-4.0.xsd "> <modelversion> 4.0.0 </modelversion> <부모> <groupid> com.itqf </groupid> <artifactid> sing-parent </artifactid> <version> 0.0.1-snapshot> </versit> <groupid> version> <artifactid> sing-manager </artifactid> <bersion> 0.0.1-snapshot </version> <packaging> pom </packaging> <pectioniles> <pectionement> <groupid> com.itqf </groupid> <artifactid> sing-common </artifactid> <version> 0.0.1-snapshot </dependence> <빌드> <플러그인> <grugin> org.apache.tomcat.maven </groupid> <artifactid> tomcat7-maven-plugin </artifactid> <configuration> <port> 8083 </path> <path>/</path> </configin> </plugins> </budual> </budual> <Modules> Sing-Manager-Pojo </module> <모듈> Sing-Manager-Interface </module> <module> Sing-Manager-Service </module> Sing-Manager-Mapper </module> </modules> </project>
2.2 집계 프로젝트에서 Maven 모듈을 만들고 이름 지정 IT Sping-Manager-Pojo (엔티티 클래스 계층).
Pojo는 일반적인 JAR 형식이며 부모 프로젝트에 의존 할 필요가 없습니다.
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/0.0.0.0 http://maven.apache.org/xsd/maven-4.0.xsd "> <modelversion> 4.0.0 </modelversion> <부모> <groupid> com.itqf </groupid> <artifactid> Sing-Manager </artifactid> <버전> 0.0.1-1-1-snapshot> </version> <artifactid> sing-manager-pojo </artifactid> </project>
2.3 집계 프로젝트에서 Maven 모듈을 만들고 Spring-Manager-Mapper (DAO 레이어)의 이름을 지정하십시오. pom.xml 파일에서 pojo에 의존하십시오. Mapper 레이어 메소드는 엔티티 클래스 객체를 반환하기 때문에 Pojo를 사용해야합니다.
의존성 JAR 패키지 가져 오기.
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/0.0.0.0 http://maven.apache.org/xsd/maven-4.0.xsd "> <modelversion> 4.0.0 </modelversion> <부모> <groupid> com.itqf </groupid> <artifactid> Sing-Manager </artifactid> <버전> 0.0.1-1-1-snapshot> </version> <아티 팩트> SING-MANAGER-MAPPER </artifactID> <!-종속성 pojo-> <pectionements> <pectionement> <groupId> com.itqf </groupId> <artifactid> sing-manager-pojo </artifactid> </artifactid> </dependency> <!-mybatis -> <pectionency> <groupId> org.mybatis </groupid> <artifactid> mybatis </artifactid> <버전> $ {mybatis.version} </version} </version> </exceentency> < GroupId> org.mybatis </groupid> <artifactid> mybatis-spring </artifactid> <bersion> $ {mybatis.spring.version} </version} </version} </versionency> <pectionency> <gro upid> com.github.miemiedev </groupid> <artifactid> mybatis-paginator </artifactis> <버전> $ {mybatis.paginator.version} </version> </dectientency> <de Pendency> <groupid> com.github.pagehelper </groupid> <artifactid> pagehelper </artifactid> <버전> $ {pagehelper.version} </version> </fectionency> <!- mysql-> <pectionement> <groupId> mysql </groupId> <artifactID> mySQL-connector-java </artifactID> <버전> $ {mysql.version} </version> </dectient and <!-연결 풀-> <pectionency> <groupid> com.alibaba </groupid> <artifactid> druid </artifactid> <버전> $ {druid.version} </version} </version} </fectionency> </dependencies> </project> 2.4 집계 프로젝트에서 Spring-Manager-Interface (인터페이스)를 만들고 모든 서비스 인터페이스를 독립 프로젝트에 배치하십시오. 인터페이스에서 메소드의 리턴 값이 엔티티 클래스 인 경우 POJO가 필요합니다. 따라서 POM의 Pojo 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/0.0.0.0 http://maven.apache.org/xsd/maven-4.0.xsd "> <modelversion> 4.0.0 </modelversion> <부모> <groupid> com.itqf </groupid> <artifactid> Sing-Manager </artifactid> <버전> 0.0.1-1-1-snapshot> </version> <Artifactid> sing-manager-interface </artifactid> <pectinements> <pectionement> <groupid> com.itqf </groupid> <artifactid> sing-manager-pojo </artifactid> <버전> 0.0.1-snapshot </dependency> </dectinements> </project>
2.5 집계 프로젝트에서 스프링 관리자 서비스 (인터페이스 구현 클래스)를 만듭니다. 포장 방법은 전쟁입니다
컨트롤러 계층이 서비스 계층과 분리되므로 실행 및 시작시 Tomcat을 사용하여 컨트롤러 및 서비스를 별도로 게시해야하며 Aggregation Project에 필요한 모든 구성 파일이 서비스에 배치되어 모든 구성 파일이로드되고 Tomcat을 시작할 때 통합됩니다.
구성 파일
SqlMapConfig.xml
<? xml version = "1.0"encoding = "utf-8"?> <! doctype configurationpublic "-// mybatis.org//dtd config 3.0 // en" "http://mybatis.org/dtd/mybatis-3-config.dtd"> </configuration>
db.properties
db.driver = com.mysql.jdbc.driverdb.url = jdbc : mysql : // localhost : 3306/taotao? characterencoding = utf-8db.username = rootdb.password = root
applicationContext-tx.xml
<? xml 버전 = "1.0"alcoding = "utf-8"?> <beans xmlns = "http://www.springframework.org/schema/beans"xmlns : xsi = "http://ww.w.w3.org/2001/xmlschema-instance" xmlns : p = "http://www.springframework.org/schema/p"xmlns : context = "http://www.springframework.org/s chema/context "xmlns : mvc ="http://www.springframework.org/schema/mvc "xmlns : tx ="http : //www.springfr amework.org/schema/tx"Xmlns:aop="http://www.springframework.org/schema/aop"xmlns:dubbo="http://c Ode.alibabatech.com/schema/dubbo"xsi:schemalocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.2.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.2.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.2.xsd http://www.spramework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.2.xsd http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.2.xsd "> <bean id ="txmanager "> <property name ="datasource "ref ="datasource "> id = "AdviceId"transaction-manager = "txmanager"> <tx : attributes> <tx : method name = "add*"propagation = "required"/<tx : method name = "save*"propagation = "필수"/> <tx : 메소드 이름 = "삽입*"propagation = "required"/> <tx : "insert*"provagation = "insert*" 이름 = "update*"propagation = "필수"/> <tx : 메소드 이름 = "del*"propagation = "필수"/> <tx : 메소드 이름 = "find*"worksation = "supports"read-now = "true"/> <tx : "get*"propagation = "supports"read-only = "true"/> </tx> <aop : Advisor Advice-Ref = "AdviceId"pointcut = "실행 (*com.itqf.service ..*.*(..))"/> </aop : config> </beans>
applicationContext-dao.xml
<? xml 버전 = "1.0"alcoding = "utf-8"?> <beans xmlns = "http://www.springframework.org/schema/beans"xmlns : xsi = "http://ww.w.w3.org/2001/xmlschema-instance" xmlns : p = "http://www.springframework.org/schema/p"xmlns : context = "http://www.springframework.org/schema/context"xmlns : mvc = "http : //www.springfr amework.org/schema/mvc"xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"xsi:schemalocation="http://www.spramframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.2.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.2.xsd http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.2.xsd "> <context : 컨텍스트 : property-placeholder location ="classpath : resource/*. properties "/> <bean id ="dataSource "> <property name ="property className = "{driverclassName ="$ {db.driver} "> value = "$ {db.url}"> </property> <속성 이름 = "username"value = "$ {db.username}"> </property> <property name = "password"value = "$ {db.password}"> </property> <property name = "maxactive"value = "10"> <속성 이름 = "minidle" "minidle" "minidle" <ean> <속성 이름 = "DataSource"ref = "DataSource"> </property> <property name = "configlocation"value = "classpath : mybatis/sqlmapconfig.xml"> </bean> <bean> <property name = "basepackage"value = "com.itqf.mapper"> </bean> </bean> </bean> </bean> </bean> </bean> </bean> applicationContext-service.xml
<? xml 버전 = "1.0"alcoding = "utf-8"?> <beans xmlns = "http://www.springframework.org/schema/beans"xmlns : xsi = "http://ww.w.w3.org/2001/xmlschema-instance" xmlns : p = "http://www.springframework.org/schema/p"xmlns : context = "http://www.springframework.org/schema/context"xmlns : mvc = "http : //www.springfr amework.org/schema/mvc"xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"xsi:schemalocation="http://www.spramframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.2.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.2.xsd http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.2.xsd "> <context : component-scan base-package ="com.itqf.service "> </context : component-scan> </beans>
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/0.0.0.0 http://maven.apache.org/xsd/maven-4.0.xsd "> <modelversion> 4.0.0 </modelversion> <부모> <groupid> com.qianfeng </groupid> <artifactid> Sing-Manager </artifactid> <version> 0.0.1-snapshot> <Artifactid> Sing-Manager-Service </artifactid> <parizage> War </packaging> <pectients> <pectionement> <prectionement> <groupid> com.qianfeng </groupId> <artifactid> sing-manager-interface </artifactid> <version> 0.0.1-snapshot </version> <proncent> <group. <artifactid> Sing-Manager-Mapper </artifactid> <bersion> 0.0.1-snapshot </version> </fectionency> <!-스프링 -> <pectionency> <groupId> org.springframework </groupid> <artifactid> spring-context </artifactid> <버전> $ {spring.version} </version} </version} </version> <pectionency> <groupid> org.springframwork </groupid> <artifactid> spring-beans </artifactid> ring.version} </version> </dependency> <pectionency> <groupid> org.springframework </groupid> <artifactid> spring-webmvc </artifactid> <버전> $ {spring.version} </version> </depinement> <groupid> org.springframeword> <artifactid> jdbc </artifactid> <bersion> $ {spring.version} </version> </dependency> <pectionement> <groupid> org.springframework </groupid> <artifactid> spring-aspects </artifactid> <버전> $ {spring.version} </dependency> <GroupSPRID> org rk </groupid> <artifactid> spring-jms </artifactid> <bersion> $ {spring.version} </version> </dependency> <pectionency> <groupid> org.springframework </groupid> <artifactid> spring-context-support </artifactid> <version {spring.version} </version} </version} </종속성> </project>최종 엔지니어링 구조
3 Dubbo를 사용하여 서비스를 게시하십시오
먼저 생각해?
Taobao 및 JD와 같은 쇼핑몰 웹 사이트는 PC 쪽뿐만 아니라 휴대폰 측면에서도 로그인 할 수 있습니다. 어떻게 구현됩니까? 두 개의 컨트롤러를 작성 하시겠습니까? 그것은 확실히 아닙니다. 할 일이 없을 때 누가 할 일이 없을까요? 그런 다음 SOA (서비스 지향 아키텍처)를 사용해야합니다. 분산을 사용하여 프로젝트를 작성할 때 서로 전화 할 수있는 많은 시스템이있을 것입니다. 앞뒤로 호출하면 코드 구조가 매우 혼란 스러울 것입니다. 여기서 우리는 Dubbo를 사용하여 너무 많은 출판 서비스의 문제를 해결하고 명확하지 않습니다.
SOA는 무엇입니까?
SOA는 여러 서비스를 포함하는 설계 방법이며, 서비스는 결국 협력을 통해 일련의 기능을 제공합니다. 서비스는 일반적으로 운영 체제 프로세스에서 독립적 인 형태로 존재합니다. 서비스는 프로세스 내 호출이 아닌 네트워크를 통해 통신합니다.
예를 들어, 뉴스 서비스 (뉴스 릴리스, 시청, 수정, 삭제 제공), 주문 서비스 (주문 첨가, 주문 수정, 주문보기, 주문 삭제 등) 금융 서비스 (수익, 지출, 통계 등) 직원 서비스 (신규, 수정, 통계, 통계, 통계 등) 판매 서비스 (판매, 판매 통계, 판매, 판매, 판매 서비스).
더보
Dubbo 란 무엇입니까 (자원 예약 및 거버넌스 센터를위한 관리 도구)
인터넷 개발을 통해 웹 사이트 응용 프로그램 규모가 지속적으로 확장되었으며 기존의 수직 응용 프로그램 아키텍처는 더 이상 대처할 수 없습니다. 분산 서비스 아키텍처 및 모바일 컴퓨팅 아키텍처가 필수적입니다. 건축의 질서있는 진화를 보장하기 위해 거버넌스 시스템이 시급히 필요합니다.
단일 응용 프로그램 아키텍처
수직 응용 프로그램 아키텍처
분산 서비스 아키텍처
흐름 컴퓨팅 아키텍처
더보 환경의 건설 :
노드 역할 설명 :
통화 관계 설명 :
여기서 우리는 주로 레지스트리 센터 (레지스트리)에 와서 Zookeeper를 사용하여 레지스트리 센터 역할을합니다.
Linux 환경, Zookeeper에 레지스트리를 배치하십시오
첫 번째 단계는 물론 가상 머신을 켜는 것이므로 CentOS7에서 수행하겠습니다.
Zookeeper 압축 패키지를 온라인으로 받으십시오. 광산은 Zookeeper-3.4.6.tar.gz입니다
/opt 디렉토리에 붙여 넣고 압축을 삭제하십시오. (JDK 환경이 필요합니다. JDK 환경이없는 경우 먼저 JDK를 설치하십시오).
Zookeeper-3.4.6 디렉토리를 입력하고 Data라는 폴더를 만듭니다.
ZOO.CFG에서 ./conf 디렉토리에서 ZOO_SAMPLE.CFG 이름 바꾸기 ZOO.CFG에서 데이터 속성 수정 : DatAdir =/opt/Zookeeper-3.4.6/Data
Step 7:
Zookeeper가 시작되면 방화벽을 끄야합니다 !!! 그게 다야.
서비스를 공개하려면 서비스에 구성 파일 추가 ApplicationContext-Service.xml
<!-Dubbo를 사용하여 서비스를 게시합니다-> <!-서비스가 위치한 프로젝트를 나타냅니다-> <dubbo : application name = "sing-manager"/> <!-레지스트리 주소는 Linux의 IP 주소와 포트 번호의 기본 포트 번호가 2181-> <dubbo : "Zookeeper" "10.117.198:2181"임을 나타냅니다. > </dubbo : registry> <!-서비스를 특정 포트 포트 번호에 노출시키고, 점유되지 않은 포트를 선택하십시오-> <dubbo : "dubbo"port = "20888"> </dubbo : protocol> <!-특정 포트 포트 번호에 서비스를 노출시키지 않는 포트를 선택하십시오-</dubbo : </"/"> ">"> ">"> ">"> ">"> ">"/">"Protocol name = "20888"> " <!-ref는 스프링 컨테이너에서 만든 서비스 객체의 이름입니다-> <dubbo : service interface = "com.itqf.service.itemservice"ref = "itemserviceimpl"timeout = "6000000"> </dubbo : service>
서비스에서 패키지 가져 오기 pom.xml
<!-Dubbo 관련-> <pectionency> <groupid> com.alibaba </groupid> <artifactid> dubbo </artifactid> <!-의존성 제외 -> <제외> <exclusion> <groupId> org.springframework </groupid> <artifactid> spring </artifactid> </exclusion> <exclusion> <groupid> org.jboss.netty </groupid> <tritifactid> netty </artifactid> </제외> >/의존성> <pectionency> <groupId> org.apache.zookeeper </groupid> <artifactid> Zookeeper </artifactid> </fectionency> <pectionency> <groupid> com.github.sgroschupf </groupid> <artifactid> zkclient </artifactid> </semption>
4 총 프로젝트와 같은 수준에있는 스프링 관리자 컨트롤러를 만듭니다. 수입 종속성.
위로는 서비스 계층에서 게시 한 서비스에 액세스하려면 Dubbo를 사용해야합니다. 물론 Tomcat 서버를 사용하려면 SpringMVC도 필요합니다.
xml
<pectionies> <!-서비스 인터페이스에 의존-> <pectionency> <groupid> com.qianfeng </groupId> <artifactid> sing-manager-interface </artifactid> <버전> 0.0.1-snapshot </dependency> <!-스프링 -> <pectionency> <groupId> org.springframework </groupid> <artifactid> spring-context </artifactid> <버전> $ {spring.version} </version} </version} </version> <pectionency> <groupid> org.springframwork </groupid> <artifactid> spring-beans </artifactid> ring.version} </version> </dependency> <pectionency> <groupid> org.springframework </groupid> <artifactid> spring-webmvc </artifactid> <버전> $ {spring.version} </version> </depinement> <groupid> org.springframeword> <artifactid> jdbc </artifactid> <bersion> $ {spring.version} </version> </dependency> <pectionement> <groupid> org.springframework </groupid> <artifactid> spring-aspects </artifactid> <버전> $ {spring.version} </dependency> <GroupSPRID> org rk </groupid> <artifactid> spring-jms </artifactid> <bersion> $ {spring.version} </version> </dependency> <pectionement> <groupid> org.springframework </groupId> <artifactid> spring-context-support </artifactid> <$ version {spring.version}-</version> <! jsp-related-> <pectionency> <groupId> jstl </groupId> <artifactid> jstl </artifactid> </fectionency> <pectionement> <groupid> javax.servlet </groupid> <artifactid> servlet-api </a rtifactid> <cope> 제공 </scope> </fectionency> <pectionency> <groupid> javax.servlet </groupid> <artifactid> jsp-api </artifactid> <cope> 제공 </scope> </dependency> <!- Dubbo 관련-> <ceptency> <groupid> com.alibaba </groupid> <artifactid> dubbo </artifactid> <!-종속성을 제외하십시오 -> <제외> <exclusion> <groupId> org.springframework </groupid> <artifactid> spring </artifactid> </exclusion> <exclusion> <groupid> org.jboss.netty </groupid> <tritifactid> netty </artifactid> </제외> >/의존성> <pectionency> <groupid> org.apache.zookeeper </groupid> <artifactid> Zookeeper </artifactid> </eppendency> <pectionement> <groupid> com.github.sgroschupf </groupid> <artifactid> zkclient </artifactid> </dependencies> <빌드> <플러그인> <grugin> org.apache.tomcat.maven </groupid> <artifactid> tomcat7-maven-plugin </artifactid> <configuration> <port> 8081 </포트>/</path> </configurn> </plugins> </budual> spingmvc.xml
<? xml 버전 = "1.0"alcoding = "utf-8"?> <beans xmlns = "http://www.springframework.org/schema/beans"xmlns : xsi = "http://ww.w.w3.org/2001/xmlschema-instance" xmlns : p = "http://www.springframework.org/schema/p"xmlns : context = "http://www.springframework.org/s chema/context "xmlns : mvc ="http://www.springframework.org/schema/mvc "xmlns : tx ="http : //www.springfr amework.org/schema/tx"Xmlns:aop="http://www.springframework.org/schema/aop"xmlns:dubbo="http://c Ode.alibabatech.com/schema/dubbo"xsi:schemalocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.2.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.2.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.2.xsd http://www.spramework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.2.xsd http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.2.xsd "> <context : component-scan base-package ="com.itqf.controller "> component : component : scan> <MVC : Annotation-Driven> </MVC : Annotation-Driven> <ean> <bean> <property name = "prefix"value = "/web-inf/jsp/"> </property name = "property name ="volucix "value =". jsp "> </property> </bean> <! </bean> <! 센터-> <dubbo : registry protocol = "Zookeeper"address = "10.0.117.198:2181"> </dubbo> <!-서비스 호출-> <dubbo : com.itqf.service.itemservice "id ="intemervice "> </dubbo : reference> </bans>
구조 다이어그램 :
5 스프링 커먼을 만듭니다
이곳은 구체적으로 도구를 배치하는 데 사용해야하는 곳으로, 공개적으로 요구하는 데 사용됩니다. 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/0.0.0.0 http://maven.apache.org/xsd/maven-4.0.xsd "> <modelversion> 4.0.0 </modelversion> <부모> <groupid> com.itqf </groupid> <artifactid> sing-parent </artifactid> <version> 0.0.1-snapshot> </versit> <groupid> version> <artifactid> sing-common </artifactid> <bersion> 0.0.1-snapshot </version> <pectionies> <!-시간 조작 구성 요소-> <pectionency> <groupid> joda-time </groupid> <artifactid> joda-time </artifactid> <version> $ {joda-time.version} </version> 구성 요소-> <pectionency> <groupid> org.apache.commons </groupid> <artifactid> commons-lang3 </artifactid> <버전> $ {commons-lang3.version} </version> </dependency> <pelection> <groupid> org.apache.commons </groupid> <artifact id> commons-io </artifactid> <버전> $ {commons-io.version} </version} </version} </version} </version} </version} </dependency> <groupid> commons-net </groupid> <artifactid> commons-net </artifactid> <버전> $ {commons-net.version} </dependency> <!-Jackson Json Processed 툴킷-> <pectionency> <groupId> com.fasterXml.jackson.core </groupId> <artifactID> Jackson-databind </artifactid> <버전> $ {Jackson.version} </version> </fectionencies> </project>6 테스트
좋아,이 의사 분포 프로젝트가 구축되었습니다. 다음으로 중요한 점은 부모 프로젝트, 스프링 관리자의 집계 프로젝트 및 스프링 커먼을 로컬 창고에 설치해야한다는 것입니다. 그렇지 않으면 프로젝트를 시작할 때 오류 가보고되며 부모 프로젝트 또는 기타 프로젝트를 찾을 수 없습니다.
최종 도면 :
요약 :
몇 시간 동안 노력한 후 마침내 나는 그것을 만들었습니다. 피곤하고 폭발 할 노인. 실수 나 단점이 있다면 기꺼이 그렇게하십시오.
위는이 기사의 모든 내용입니다. 모든 사람의 학습에 도움이되기를 바랍니다. 모든 사람이 wulin.com을 더 지원하기를 바랍니다.