我正在尝试创建 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
Spring引导版本3.2.0 spring-cloud.版本 2023.0.0 java.version 17
应用程序.属性
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
对我来说这似乎是一个类修饰符错误。转到下面的类并检查它是否是最终的。如果您已将其声明为final,则删除final关键字,因为Spring代理过程要求该类不是final或可见的
org.springframework.cloud.gateway.server.mvc.config.GatewayMvcPropertiesBeanDefinitionRegistrar$RouterFunctionHolder