2019-10-31 spring Cloud 无法注册到nac

2019-10-31  本文已影响0人  小苏c

最近在学习nacos的使用,按照官方文档写了一个SpringCloud+nacos的小demo,却发现注册进nacos注册中心,日志是这样的:

注册不上日志

后来发现我springboot的版本是2.2.0.RELEASE

降低到 2.0.8.RELEASE后就能注册了,和nacos的官网说明:版本 0.2.x.RELEASE 对应的是 Spring Boot 2.x 版本,版本 0.1.x.RELEASE 对应的是 Spring Boot 1.x 版本有些偏差。

此处:nacos 1.1.4  、

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 https://maven.apache.org/xsd/maven-4.0.0.xsd">

<modelVersion>4.0.0</modelVersion>

<parent>

<groupId>org.springframework.boot</groupId>

<artifactId>spring-boot-starter-parent</artifactId>

        <version>2.0.8.RELEASE</version>

<relativePath/>

    </parent>

<groupId>com.candy</groupId>

<artifactId>nacos-remotecall</artifactId>

<version>0.0.1-SNAPSHOT</version>

<name>nacos-remotecall</name>

<description>Demo project for Spring Boot</description>

<properties>

<java.version>1.8</java.version>

<junit.version>4.10</junit.version>

<spring-cloud.version>Finchley.SR2</spring-cloud.version>

</properties>

<dependencies>

        <dependency>

<groupId>org.springframework.boot</groupId>

<artifactId>spring-boot-starter-web</artifactId>

</dependency>

        <dependency>

<groupId>org.springframework.cloud</groupId>

<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>

<version>0.9.0.RELEASE</version>

</dependency>

        <dependency>

<groupId>org.springframework.cloud</groupId>

<artifactId>spring-cloud-starter-openfeign</artifactId>

<version>2.0.0.RELEASE</version>

</dependency>

        <dependency>

<groupId>org.springframework.boot</groupId>

<artifactId>spring-boot-starter-test</artifactId>

<scope>test</scope>

<exclusions>

<exclusion>

<groupId>org.junit.vintage</groupId>

<artifactId>junit-vintage-engine</artifactId>

</exclusion>

</exclusions>

</dependency>

        <dependency>

<groupId>junit</groupId>

<artifactId>junit</artifactId>

<version>${junit.version}</version>

<scope>test</scope>

</dependency>

</dependencies>

<dependencyManagement>

<dependencies>

<dependency>

<groupId>org.springframework.cloud</groupId>

<artifactId>spring-cloud-dependencies</artifactId>

<version>${spring-cloud.version}</version>

<type>pom</type>

<scope>import</scope>

</dependency>

</dependencies>

</dependencyManagement>

<build>

<plugins>

<plugin>

<groupId>org.springframework.boot</groupId>

<artifactId>spring-boot-maven-plugin</artifactId>

</plugin>

</plugins>

</build>

</project>

上一篇下一篇

猜你喜欢

热点阅读