springcloud、consul和Springboot的版本

今天以consul作注册中心的时候出现版本不匹配问题
查看官网看见
官网的是这样的图:
springcloud、consul和Springboot的版本_第1张图片
在自己的项目中使用consul是2.0.3,控制台报错显示建议改springboot版本为2.0.x,springcloud版本 Greenwich
目前的依赖:

  <parent>
        <groupId>org.springframework.bootgroupId>
        <artifactId>spring-boot-starter-parentartifactId>
        <version>2.0.2.RELEASEversion>
        <relativePath/> 
    parent>
    <properties>
        <project.build.sourceEncoding>UTF-8project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8project.reporting.outputEncoding>
        <java.version>1.8java.version>
        <spring-cloud.version>Greenwichspring-cloud.version>
    properties>
    <groupId>com.cloudgroupId>
    <artifactId>demoartifactId>
    <version>0.0.1-SNAPSHOTversion>
    <name>demoname>
    <description>Demo project for Spring Bootdescription>

    <dependencies>
        <dependency>
            <groupId>org.springframework.bootgroupId>
            <artifactId>spring-boot-starter-webartifactId>
        dependency>

        <dependency>
            <groupId>org.springframework.bootgroupId>
            <artifactId>spring-boot-devtoolsartifactId>
            <scope>runtimescope>
            <optional>trueoptional>
        dependency>
        <dependency>
            <groupId>org.springframework.bootgroupId>
            <artifactId>spring-boot-configuration-processorartifactId>
            <optional>trueoptional>
        dependency>
     
       
        <dependency>
            <groupId>org.springframework.bootgroupId>
            <artifactId>spring-boot-starter-testartifactId>
            <scope>testscope>
        dependency>


      
        <dependency>
            <groupId>org.springframework.cloudgroupId>
            <artifactId>spring-cloud-starter-consul-discoveryartifactId>
            <version>2.0.3.RELEASEversion>
        dependency>

改配置:

spring.cloud.consul.host=localhost
spring.cloud.consul.port=8500
spring.cloud.consul.discovery.service-name=myprovider
server.port=8002
management.endpoints.web.exposure.include=*
management.endpoint.health.show-details=always

启动类加上@EnableDiscoveryClient

运行后在8500端口可以看到自己刚刚注册的服务:
springcloud、consul和Springboot的版本_第2张图片

目前版本问题在springcloud当中似乎很容易出错,留待继续学习。

你可能感兴趣的:(微服务框架,spring,cloud,consul,spring,boot)