我正在尝试创建Spring Cloud Gateway服务器。但当服务器启动时出现以下错误
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'routerFunctionMapping' defined in class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]: Error creating bean with name 'gatewayCompositeRouterFunction': Unsatisfied dependency expressed through constructor parameter 0: Error creating bean with name 'gatewayRouterFunctionHolder' defined in BeanDefinition defined in null: Could not generate CGLIB subclass of class org.springframework.cloud.gateway.server.mvc.config.GatewayMvcPropertiesBeanDefinitionRegistrar$RouterFunctionHolder: Common causes of this problem include using a final class or a non-visible class
字符串
Sping Boot version 3.2.0 spring-cloud.version 2023.0.0 java.version 17
application.properties
spring.application.name=gateway-server
server.port=9090
# Eureka config
eureka.client.service-url.defaultZone=${EUREKA_URI:http://localhost:8761/eureka}
spring.cloud.gateway.discovery.locator.lower-case-service-id=true
spring.cloud.gateway.discovery.locator.enabled=true
型
3条答案
按热度按时间mzmfm0qo1#
这似乎是一个类修饰符错误给我。去下面的类,并检查它是否是final或不是。如果你已经声明了它final然后删除final关键字作为Spring编译过程要求类是非final的。它也需要可见。
字符串
eqqqjvef2#
尝试将POM中的依赖项从“gateway-mvc”更改为“gateway”;
字符串
下面;
型
4dbbbstv3#
似乎
spring-cloud-starter-gateway-mvc
与spring-boot-devtools
冲突试着删除
spring-boot-devtools
,希望能有帮助