Netsol User
Netsol User

Reputation: 11

How to include spring-cloud-dependencies in Spring boot project

I have a microservice architecture for my Spring Boot application using Maven and Java, while the new chat-service utilizes Gradle and Kotlin. I also have a common-service that contains shared classes and dependencies, but it doesn't have a main class. This service is included as a local dependency in other projects like this:

<dependency>
    <groupId>com.example.app</groupId>
    <artifactId>app-common</artifactId>
    <scope>compile</scope>
    <version>${project.version}</version>
</dependency>

It includes spring-cloud-dependencies as follows:

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

However, I cannot access org.springframework.cloud in chat-service, despite having added the common dependency. In auth-service (Maven/Java), it works correctly. Consequently, I am unable to access Eureka properties in chat-service, while all other services register successfully.

I have used this spring starter.

I have tried this Spring Blog and asked AI Chat Engines as well.

Here is my properties file in chat-service

eureka.instance.prefer-ip-address=true
eureka.client.service-url.defaultZone=http://localhost:8081/eureka

Upvotes: 1

Views: 68

Answers (0)

Related Questions