SpringBoot升级2.3.7到2.5.4 - KafkaStreamsAutoConfiguration问题<



这些是pom.xml中的依赖项。spring-cloud.version is 2020.0.3

<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>
<dependencies>
<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka-streams</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-function-context</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-sleuth-zipkin</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-sleuth</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-stream</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-stream-binder-kafka</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-stream-binder-kafka-streams</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.kafka</groupId>
<artifactId>spring-kafka</artifactId>
</dependency>
<dependency>
<groupId>io.zipkin.brave</groupId>
<artifactId>brave-instrumentation-spring-web</artifactId>
<version>5.6.10</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-function-kotlin</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
...Rest omitted

应用程序启动失败
Description:
Parameter 0 of method kafkaStreamsFunctionProcessorInvoker in org.springframework.cloud.stream.binder.kafka.streams.function.KafkaStreamsFunctionAutoConfiguration required a bean named '&getRestTemplate_registration' that could not be found.

Action:
Consider defining a bean named '&getRestTemplate_registration' in your configuration.

这是奇怪的部分-我有一个Bean定义

/**
* Functional bean which gets / builds the RestTemplate for the given request
* @return the rest template or null if no configuration exists
*/
@Bean
fun getRestTemplate(): (RestCallRequest) -> RestTemplate? {
return { restCallRequest -> getRestTemplateNameForUrl(restCallRequest.url)?.let(::getOrBuildRestTemplate) }
}

,它是自动连接的,如下图所示,在另一个类

@Autowired
private lateinit var getRestTemplate: (RestCallRequest) -> RestTemplate?

可以在SpringBoot 2.3.7中工作,但在更新后不能工作。有人能给我一个提示如何解决这个问题吗?为什么Bean以&为前缀,并以_registration为后缀?我不会在整个应用程序中使用这个术语。

我拼命地按照建议定义了Bean。结果是:

Consider defining a bean named '&getRestTemplate_registration_registration' in your configuration.

经过大量调试后,我们能够找到的唯一解决方案是:

@SpringBootApplication(exclude =[KotlinLambdaToFunctionAutoConfiguration::class])

包含重现问题的小示例项目的Bug报告如下:https://github.com/spring-cloud/spring-cloud-function/issues/735.

相关内容

  • 没有找到相关文章

最新更新