小白学习eureka时遇到的一些问题

今天在学习eureka,在跟着视频进行编码的时候,遇到了eureka的一些问题
问题一:
@EnableEurekaServer无法正确的被引入
查阅了百度的一些资料,主要说明是springboot与spingcloud的版本不一致,使用Finchley.RELEASE版本即可。
在这里插入图片描述
修改了此处,发现@EnableEurekaServer仍然没有被引入,了解到导致不能正确的进行版本引入的时候,多是配置的问题,所以我重新查看了一下pom.xml文件

子pom.xml
在这里插入图片描述
父pom.xml
在这里插入图片描述
少了刚刚创建的eureka的项目
补充一下,修改后的配置为:
子pom.xml
在这里插入图片描述
父pom.xml文件
在这里插入图片描述
在子pom.xml文件中正确的配置eureka

<dependencies>      
        <!--启动需要-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-netflix-eureka-server</artifactId>
            <version>2.1.1.RELEASE</version>
        </dependency>
    </dependencies>

此时可以正确的进行@EnableEurekaServer的引入了
进行部署的时候,遇到了第二个问题:java.lang.AbstractMethodError: null
在这里插入图片描述
从百度上查看,仍然是版本不匹配的问题,此时需要将父pom.xml文件中的配置修改为2.1.1RELEASE

 <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.1.1.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>

重新部署后,发现了第三个问题:

***************************
APPLICATION FAILED TO START
***************************
 
Description:
 
The bean 'eurekaRegistration', defined in class path resource
 [org/springframework/cloud/netflix/eureka/EurekaClientAutoConfiguration$EurekaClientConfigu
ration.class], could not be registered. A bean with that name has already been defined in
 class path resource [org/springframework/cloud/netflix/eureka/EurekaClientAutoConfiguration$RefreshableEurekaC
lientConfiguration.class] and overriding is disabled.
 
Action:
 
Consider renaming one of the beans or enabling overriding by setting spring.main.allow
-bean-definition-overriding=true

百度过程中找到一篇博文
在这里插入图片描述
https://blog.csdn.net/yjt520557/article/details/91408635

就是将

 <artifactId>spring-cloud-netflix-eureka-server</artifactId>

修改为

<artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>

重新启动部署,成功
在这里插入图片描述

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值