goya
goya

Reputation: 165

SpringBoot Upgrade 2.3.7 to 2.5.4 - Issue with KafkaStreamsAutoConfiguration

These are the Dependencies in the 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

Application fails to start due to

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.

This is the weird part - i do have a Bean defined

    /**
     * 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) }
    }

and it's being Autowired like shown below in another Class

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

Works in SpringBoot 2.3.7 but not now after the update. Can anyone please give me a hint how to resolve this. Why is the Bean getting prefixed with an & and postfixed with _registration? I'm not using that Term in the whole application.

Desperatly i defined a Bean as suggested. Outcome was:

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

Upvotes: 4

Views: 1696

Answers (1)

goya
goya

Reputation: 165

After a lot of debugging, the only workaround we were able to find is:

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

A Bug report containing a small sample project to reproduce the problem is written: https://github.com/spring-cloud/spring-cloud-function/issues/735.

Upvotes: 4

Related Questions