GET request to config service http://localhost:8888/dictionary/default
return valid JSON with properties.
Dictionary service fail to start without properties:
@SpringBootApplication
@EnableEurekaClient
public class DictionaryApplication {
public static void main(String[] args) {
SpringApplication.run(DictionaryApplication.class, args);
}
}
bootstrap.yml
spring:
application:
name: dictionary
profiles:
active: default
cloud:
config:
uri: localhost:8888/dictionary
build.gradle
ext {
set('springCloudVersion', "2021.0.2")
}
dependencies {
implementation 'org.springframework.cloud:spring-cloud-starter-bootstrap'
implementation 'org.springframework.cloud:spring-cloud-config-client'
implementation 'org.springframework.boot:spring-boot-starter-actuator'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-validation'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.cloud:spring-cloud-starter-netflix-eureka-client'
compileOnly 'org.projectlombok:lombok'
developmentOnly 'org.springframework.boot:spring-boot-devtools'
runtimeOnly 'org.postgresql:postgresql'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
}
What is mistake? Why properties not fetch?
CodePudding user response:
You don't need to add /dictionary
path to your cloud config uri. Just localhost:8888
is enough.