美文网首页
Spring boot服务的注册与发现demo(一)

Spring boot服务的注册与发现demo(一)

作者: 毛宇鹏 | 来源:发表于2017-03-23 11:23 被阅读185次

    原文地址:http://www.maoyupeng.com/springboot-cloud-register-and-found.html

    简单演示使用idea搭建Spring boot模块化项目结构搭建及Spring boot服务发现与注册 (该文章为作者笔记,只供参考,不要学习)

    开发环境

    操作系统 Mac OS
    JDK版本 1.8
    Maven 3.0.5
    IDE IntelliJ IDEA

    项目结构规划

    修改子模块(mpi-client-service)的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">
        <parent>
            <artifactId>mpicloud</artifactId>
            <groupId>com.maoyupeng.test</groupId>
            <version>0.0.1-SNAPSHOT</version>
        </parent>
        <modelVersion>4.0.0</modelVersion>
    
        <artifactId>mpi-client-service</artifactId>
    
    
    </project>
    

    修改后

    <?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">
        <parent>
            <artifactId>mpicloud</artifactId>
            <groupId>com.maoyupeng.test</groupId>
            <!--修改: 引用父模块中的properties, 引入成功,则配置生效-->
            <version>${mpicloid.version}</version>
        </parent>
        <modelVersion>4.0.0</modelVersion>
    
        <artifactId>mpi-client-service</artifactId>
    
    </project>
    

    验证

    由上图可知,在mpi-client-service(pom.xml)里面没有引入任何的依赖包,但是在Maven Dependencies 里面,则显示出了与父模块一样的引用依赖.

    最后的项目结构

    其他子模块的新建步骤雷同,所以省略...

    w400w400

    Spring-boot服务的注册与发现demo(二):http://www.maoyupeng.com/springboot-cloud-register-and-found-2.html

    相关文章

      网友评论

          本文标题:Spring boot服务的注册与发现demo(一)

          本文链接:https://www.haomeiwen.com/subject/vzsznttx.html