gpt4 book ai didi

spring-boot - Spring Boot 升级 2.3.7 到 2.5.4 - KafkaStreams 自动配置问题

转载 作者:行者123 更新时间:2023-12-04 12:21:37 25 4
gpt4 key购买 nike

这些是 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) }
}

它正在 Autowiring ,如下所示在另一个类中
    @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])
包含重现该问题的小示例项目的错误报告已写入: https://github.com/spring-cloud/spring-cloud-function/issues/735 .

关于spring-boot - Spring Boot 升级 2.3.7 到 2.5.4 - KafkaStreams 自动配置问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68949110/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com