初学dubbo+zookeeper+ssm+mysql简单整合记录

本文记录了初学者在整合dubbo、zookeeper、ssm(Spring、SpringMVC、MyBatis)和mysql过程中遇到的问题及解决方案。首先介绍了所需的开发工具和环境配置,接着详细讲述了创建提供者和消费者两个maven工程的步骤,包括pom.xml配置、应用上下文配置、mybatis配置等。最后,通过主方法启动消费者调用提供者的接口,完成基本整合。
摘要由CSDN通过智能技术生成

          初学dubbo+zookeeper+ssm+mysql整合时碰到很多不知所措的问题,需要有耐心的去一一解决,我也是根据网上的资料去自己搭建的本地版初步整合(未做到web项目),因为查找资料的时候并没有去记录网址,所以并没有能作为文献去标注。

第一步 准备工作

              开发工具:IDEA

              数据库及其工具:MySQL8、Navicat for MySQL

              其他:win10系统、jdk1.8、Maven-3.6、dubbo-2.5.10、zookeeper-3.4.14

             这里要特别注意mysql8对jdk版本的要求,要jdk1.8以后的版本,要不然会报:Unsupported major minor version 52  jdk版本低的错误。

              工具类软件请百度查找安装教程,报错情况根据报错内容查找解决方法。

第二步 创建两个maven工程

              一个是提供者provide,一个是消费者consumer,两个层级结构如下图:不是特别的严谨,请见谅;

                                        

第三步  provider工程详情

先介绍provider提供者工程,

pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<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>demo-provider</groupId>
    <artifactId>demo-provider</artifactId>
    <version>1.0-SNAPSHOT</version>
        <packaging>jar</packaging>
        <name>demo-interface</name>
        <url>http://maven.apache.org</url>
        <build>
            <finalName>demo_provider</finalName>
            <plugins>
                <plugin>
                    <inherited>true</inherited>
                    <configuration>
                        <source>6</source>
                        <target>6</target>
                    </configuration>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.1</version>
                </plugin>
                <plugin>
                    <groupId>org.mybatis.generator</groupId>
                    <artifactId>mybatis-generator-maven-plugin</artifactId>
                    <version>1.3.2</version>
                    <configuration>
                        <configurationFile>src/main/resources/generatorConfig.xml</configurationFile>
                        <verbose>true</verbose>
                        <overwrite>true</overwrite>
                    </configuration>
                    <executions>
                        <execution>
                            <id>Generate MyBatis Artifacts</id>
                            <goals>
                                <goal>generate</goal>
                            </goals>
                        </execution>
                    </executions>
                    <dependencies>
                        <dependency>
                            <groupId>org.mybatis.generator</groupId>
                            <artifactId>mybatis-generator-core</artifactId>
                            <version>1.3.2</version>
                        </dependency>
                    </dependencies>
                </plugin>
            </plugins>
        </build>
        <properties>
            <spring.version>3.2.8.RELEASE</spring.version>
        </properties>
        <dependencies>

            <dependency>
                <groupId>com.alibaba</groupId>
                <artifactId>dubbo</artifactId>
                <version>2.5.10</version>
                <exclusions>
                    <exclusion>
                        <groupId>org.springframework</groupId>
                        <artifactId>spring</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>com.github.sgroschupf</groupId>
                <artifactId>zkclient</artifactId>
                <version>0.1</version>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-core</artifactId>
                <version>4.2.6.RELEASE</version>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-beans</artifactId>
                <version>4.2.6.RELEASE</version>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-context</artifactId>
                <version>4.2.6.RELEASE</version>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-jdbc</artifactId>
                <version>4.2.6.RELEASE</version>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-web</artifactId>
                <version>4.2.6.RELEASE</version>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-webmvc</artifactId>
                <version>4.2.6.RELEASE</version>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-aop</artifactId>
                <version>4.2.6.RELEASE</version>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-tx</artifactId>
                <version>4.2.6.RELEASE</version>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-orm</artifactId>
                <version>4.2.6.RELEASE</version>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-context-support</artifactId>
                <version>4.2.6.RELEASE</version>
            </dependency>
            <dependency&
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值