隔天找到问题后忘了 更新了 直接上代码
<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.1.8.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.xy.gulimall</groupId>
<artifactId>gulimall-coupon</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>gulimall-coupon</name>
<description>谷粒商城-优惠券服务</description>
<properties>
<java.version>1.8</java.version>
<spring-cloud.version>2022.03</spring-cloud.version>
</properties>
<dependencies>
<dependency>
<groupId>com.xy.gulimall</groupId>
<artifactId>gulimall-common</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-commons</artifactId>
</dependency>
<dependency>
<groupId>maven_repositor.org.springframework.cloud</groupId>
<artifactId>spring-cloud-commons</artifactId>
<version>2.1.0.RELEASE</version>
</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>
这是我原来的pom文件
一开始报的是这个错误:java: 无法访问org.springframework.cloud.client.discovery.EnableDiscoveryClient
类文件具有错误的版本 61.0, 应为 52.0,中间还有一段懒得从新找了,不过大概的意思是spring版本兼容问题,所以我的目光一直是放在springboot、springcloud alibaba以及jdk的版本上,一直再排查,结果还是那个前面哪个问题,一直没找出来,太晚就去睡觉了嘿嘿。
隔天重新排查的时候,终于是找到问题的所在了。之前创建项目的时候选了springcloud的openFegin,然后在创建完项目后,我又变动了spring的版本,所以就出现错误了。
<properties>
<java.version>1.8</java.version>
<spring-cloud.version>Greenwich.SR3</spring-cloud.version>
</properties>