spring-cloud / spring-cloud-schema-registry

A schema registry implementation for Spring Cloud Stream
47 stars 28 forks source link

Upgrading to Spring Cloud 2020.0.0: SchemaRegistryClientConfiguration required a bean of type 'org.springframework.boot.web.client.RestTemplateBuilder' that could not be found #50

Open davidmelia opened 3 years ago

davidmelia commented 3 years ago

Hi,

I have upgraded to Spring Boot 2.4.1 and Spring Cloud 2020.0.0 and get the following error Parameter 1 of method schemaRegistryClient in org.springframework.cloud.schema.registry.client.config.SchemaRegistryClientConfiguration required a bean of type 'org.springframework.boot.web.client.RestTemplateBuilder' that could not be found.

This is easy to simulate using a spring starter project with WebFlux and schema registry

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.4.1</version>
<!--        <version>2.3.7.RELEASE</version> -->
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.melia</groupId>
    <artifactId>schema_reg_issue</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>schema_reg_issue</name>
    <description>Demo project for Spring Boot</description>

    <properties>
        <java.version>11</java.version>
<!--        <spring-cloud.version>Hoxton.SR7</spring-cloud.version> -->
        <spring-cloud.version>2020.0.0</spring-cloud.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-webflux</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-schema-registry-client</artifactId>
        </dependency>   
    </dependencies>

    <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>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

    <repositories>
        <repository>
            <id>spring-milestones</id>
            <name>Spring Milestones</name>
            <url>https://repo.spring.io/milestone</url>
        </repository>
    </repositories>

</project>

Thanks

qwertbuddy commented 2 years ago

What's the fix for this issue? Is it present in earlier versions? I am facing this issue and my app fails to run any tests with this error. I am using MockMvc with @SpringBootTest for my test, and it isn't even related to the Schema Client registry, but just because my main class is annotated with @EnableSchemaRegistryClient I get this error