Solution for Maven
Add the below dependency in the pom.xml
file:
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-bootstrap</artifactId>
</dependency>
Solution for Gradle
Add in the build.gradle
file:
implementation('org.springframework.cloud:spring-cloud-starter-bootstrap')
That resolved my issue.