嗨,我正在实现一个spring启动应用程序与spring版本3.0.2并使用feign-reactor-webclient:3.2.6用于API客户端。每次我启动应用程序,它显示错误:
Parameter 0 of constructor in com.example.testfeignreactive.TestServiceClient required a bean of type 'reactivefeign.spring.config.ReactiveFeignNamedContextFactory' that could not be found.
这是我的主类
@SpringBootApplication
@EnableReactiveFeignClients
@EnableAutoConfiguration
class TestFeignReactiveApplication
fun main(args: Array<String>) { runApplication<TestFeignReactiveApplication>(*args) }
这里是配置
@Configuration
class CustomerClientConfig {
@Bean
fun reactiveOptions(): ReactiveOptions? {
return WebReactiveOptions.Builder()
.setReadTimeoutMillis(2000)
.setWriteTimeoutMillis(2000)
.setResponseTimeoutMillis(2000)
.build()
}
@Bean
fun loggerListener(): ReactiveLoggerListener<*>? {
return DefaultReactiveLogger(Clock.systemUTC(), LoggerFactory.getLogger(TestServiceClient::class.java))
}
}
下面是客户端界面
@ReactiveFeignClient(
name = "test-service",
url = "http://localhost:8080",
configuration = [CustomerClientConfig::class]
)
interface TestServiceClient {
@RequestMapping(method = [RequestMethod.GET], value = ["/api/v1/terms-and-conditions"])
fun getTermAndCondition(): Mono<String>
}
有什么解决办法吗?
19/04/2022: Feign Reactive目前不支持Spring Boot 3。参见github上的问题