zoukankan      html  css  js  c++  java
  • springboot无法引入@enableeurekaserv

    最近再添加eureka依赖时

    总是无法成功引入

    导致程序@enableeurekaserver报错

    最终找到原因是springboot与springcloud的支持版本不一致

    1、pom中添加依赖

    <dependencies>
    <dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter</artifactId>
    </dependency>
    <dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-eureka-server</artifactId>
    </dependency>
    <dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-test</artifactId>
    <scope>test</scope>
    </dependency>
    </dependencies>


    2、添加启动代码中添加@EnableEurekaServer注解
    @SpringBootApplication
    @EnableEurekaServer
    public class SpringCloudEurekaApplication {
    
    	public static void main(String[] args) {
    		SpringApplication.run(SpringCloudEurekaApplication.class, args);
    	}
    }


    3、配置文件
    erver.port=1111
    eureka.client.register-with-eureka=false
    eureka.client.fetch-registry=false
    eureka.client.serviceUrl.defaultZone=http://localhost:${server.port}/eureka/
     
  • 相关阅读:
    点击鼠标上下滚动
    点击小圆圈切换图片(基础)
    js取整数、取余数的方法
    几张图片滚动切换
    (转)iPhone +ipad尺寸规范(界面 & 图标)
    基础选择分类
    JDBC事务
    JDBC
    mysql
    网络编程三要素
  • 原文地址:https://www.cnblogs.com/quzhongren/p/11005677.html
Copyright © 2011-2022 走看看