當我嘗試啟動 springboot-admin 時,它拋出: java.lang.NoClassDefFoundError: org/springframework/cloud/netflix/zuul/ZuulServerAutoConfiguration 這是我的版本沖突嗎?SpringBoot版本:2.1.9.RELEASESpringCloud版本:Greenwich.SR3SpringBootAdmin版本:2.1.5我的主類代碼:@Configuration@EnableAutoConfiguration@EnableAdminServer@EnableDiscoveryClientpublic class SpringbootAdminApplication { public static void main(String[] args) { SpringApplication.run(SpringbootAdminApplication.class, args); }}我的maven代碼: <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.1.9.RELEASE</version> <relativePath/> <!-- lookup parent from repository --> </parent><!-- It's partly dependent--><dependency> <groupId>de.codecentric</groupId> <artifactId>spring-boot-admin-starter-server</artifactId> <version>2.1.5</version> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-eureka</artifactId> </dependency> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-dependencies</artifactId> <version>Greenwich.SR3</version> <type>pom</type> <scope>import</scope> </dependency>我的配置文件:spring: application: name: spring-boot-admineureka: client: service-url: defaultZone: http://localhost:8010/eurekaserver: port: 8083我想啟動應用程序
1 回答

弒天下
TA貢獻1818條經驗 獲得超8個贊
將 spring-cloud 依賴項移到 dependencyManagement 標簽下,然后嘗試,
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>Greenwich.SR3</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
添加回答
舉報
0/150
提交
取消