SpringCloud项目pom.xml配置

上篇说了SpringCloud项目目录的搭建,本篇着重描述项目pom.xml等其他文件的配置
首先声明,本项目整体用的是SpringCloud+SpringBoot+Mybatis-plus框架
根项目pom.xml配置如下:


     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">
4.0.0

org.example
auxiliaryMonitoring
1.0-SNAPSHOT
auxiliaryMonitoring


    consumer
    eureka-server
    provider
    system




    org.springframework.boot
    spring-boot-starter-parent
    2.4.0
     




    UTF-8
    UTF-8
    1.8
    Dalston.SR1



    
    
        org.springframework.boot
        spring-boot-starter-actuator
    
    
    
        org.springframework.cloud
        spring-cloud-starter-eureka-server
    
    
    
        org.springframework.boot
        spring-boot-starter-web
    
    
    
        org.springframework.boot
        spring-boot-starter-test
        test
    



    
        
            org.springframework.cloud
            spring-cloud-dependencies
            ${spring-cloud.version}
            pom
            import
        
    




    
        spring-snapshots
        Spring Snapshots
        https://repo.spring.io/snapshot
        
            true
        
    
    
        spring-milestones
        Spring Milestones
        https://repo.spring.io/milestone
        
            false
        
    


主要是Spring Cloud 服务注册组件、Spring Boot 测试组件、Spring Cloud 版本序列配置、仓库配置等

注册中心pom.xml配置如下:

xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0

    org.springframework.boot
    spring-boot-starter-parent
    2.4.0
     

com.example.auxiliaryMonitoring
eureka-server
0.0.1-SNAPSHOT
eureka-server
Demo project for Spring Boot

    1.8
    2020.0.0-SNAPSHOT


    
        org.springframework.cloud
        spring-cloud-starter-netflix-eureka-server
    
    
        org.springframework.boot
        spring-boot-starter-test
        test
    



    
        
            org.springframework.cloud
            spring-cloud-dependencies
            ${spring-cloud.version}
            pom
            import
        
    



    
        
            org.springframework.boot
            spring-boot-maven-plugin
        
    



    
        spring-snapshots
        Spring Snapshots
        https://repo.spring.io/snapshot
        
            true
        
    
    
        spring-milestones
        Spring Milestones
        https://repo.spring.io/milestone
    


子项目pom.xml配置如下:

     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0

    org.springframework.boot
    spring-boot-starter-parent
    2.4.0
     

com.example
system
0.0.1-SNAPSHOT
system
Demo project for Spring Boot

    1.8
    2020.0.0-SNAPSHOT


    
        org.springframework.cloud
        spring-cloud-starter-netflix-eureka-client
    
    
        org.springframework.boot
        spring-boot-starter-test
        test
    
    
        org.springframework.boot
        spring-boot-starter-web
    
    
    
        mysql
        mysql-connector-java
        8.0.22
    
    
    
        org.mybatis.spring.boot
        mybatis-spring-boot-starter
        1.1.1
    
    
    
        org.projectlombok
        lombok
    
    
    
        ch.qos.logback
        logback-classic
    
    
    
        org.slf4j
        jcl-over-slf4j
    
    
    
        io.jsonwebtoken
        jjwt
        0.7.0
    
    
        com.auth0
        java-jwt
        3.3.0
    


    
        
            org.springframework.cloud
            spring-cloud-dependencies
            ${spring-cloud.version}
            pom
            import
        
    


    
        
            org.springframework.boot
            spring-boot-maven-plugin
        
    
    
        
            src/main/java
            
                **/*.java
            
        
        
            src/main/resources
            
                **/*.*
            
        
    


    
        spring-snapshots
        Spring Snapshots
        https://repo.spring.io/snapshot
        
            true
        
    
    
        spring-milestones
        Spring Milestones
        https://repo.spring.io/milestone
    

至此,项目基本pom.xml配置完成,跑起来的效果如下:
SpringCloud项目pom.xml配置_第1张图片
现在起了四个微服务,一个为注册中心,端口8081;三个微服务,微服务启动后会连接注册中心,各微服务间数据通信通过注册中心发现服务和数据传递。

你可能感兴趣的:(springcloud,java,后端,springboot,spring)