1

I am new to Micro-services and was following a course on it. Adding spring-cloud-starter-openfeign maven dependency throws a build error and all the other dependencies start complaining about resolve issues. I am using latest Spring Boot- 2.6.0 version, so I am guessing there might me compatibility issue as the spring-boot 2.6.0 is quite latest.

It's only the issue with openfeign, as I created a micro-service with spring-cloud-starter-config, and wanted another micro-service to call it's api through openfeign, but unable to do so.

Any discussion on what's wrong would be helpful.

P.S:

I am bootstrapping the project from Spring Initilaizr

I am using spring-cloud-dependencies version 2021.0.0-RC1

Adding the pom.xml for reference

<?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.6.0</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.nikkbh.microservices</groupId>
    <artifactId>currency-conversion-service</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>currency-conversion-service</name>
    <description>currency-conversion-service</description>
    <properties>
        <java.version>17</java.version>
        <spring-cloud.version>2021.0.0-RC1</spring-cloud.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-config</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <scope>runtime</scope>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </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>
                <configuration>
                    <excludes>
                        <exclude>
                            <groupId>org.projectlombok</groupId>
                            <artifactId>lombok</artifactId>
                        </exclude>
                    </excludes>
                </configuration>
            </plugin>
        </plugins>
    </build>
    <repositories>
        <repository>
            <id>spring-milestones</id>
            <name>Spring Milestones</name>
            <url>https://repo.spring.io/milestone</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
    </repositories>

</project>

g-newa
  • 459
  • 3
  • 10
  • I created a spring boot project with `spring-cloud-starter-openfeign` dependency but with java version 11, and there is no issue in project compilation. U can try with java version 8 or 11. – Urvashi Soni Nov 24 '21 at 13:01
  • 1
    There is no Spring Cloud version for Spring Boot 2.6. You have to wait for a compatible version. – M. Deinum Nov 24 '21 at 13:02
  • @Uravshi Soni I have JDK `17` so I guess I'll have to switch to JDK 11 till a compatible version is released for Spring Boot 2.6 like @M. Deinum said. Thanks anyways – Nikhil Bhutani Nov 24 '21 at 18:29
  • Why would you need to downgrade to JDK11? Spring Boot 2.5 and Spring 5.3 support Java17, so not sure why you think you need an upgrade for that. – M. Deinum Nov 24 '21 at 18:42
  • 1
    Yes, I have worked on prior projects with `spring-boot 2.5.7` and `JDK 17` but the only issue is with `spring-cloud-starter-open-feign`. I changed the JDK to `11` and used `spring-boot-2.6.0` it works perfectly fine without any dependency issue. – Nikhil Bhutani Nov 26 '21 at 04:58

0 Answers0