i have problem when i try to GET data spring cloud config client to spring cloud confing server. my config in the server is running, but i coundlt get the data from my client
This is my config client properties in the application.properties
spring.application.name=service-transfer
spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration
spring.config.import=optional:configserver:http://localhost:8081/
management.endpoints.web.exposure.include=*
spring.cloud.config.enabled=true
this is my config server in the application.properties
spring.application.name=Spring-Cloud-Config-Server
server.port=8081
spring.cloud.config.enabled=true
spring.cloud.config.server.git.uri=https://github.com/mendochandra/spring-cloud-config.git
spring.cloud.config.server.git.default-label=main
and this is my controller to get message in the config server @RestController public class ServiceController {
@Value("${message}")
private String myKey;
@GetMapping
public String prop(){
return "Property =" + myKey ;
}
}
Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'message' in value "${message}"
this is dendencies i used
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.cloud:spring-cloud-config-server'
// implementation 'org.springframework.cloud:spring-cloud-starter-bootstrap'
// compileOnly 'org.projectlombok:lombok'
// runtimeOnly 'com.mysql:mysql-connector-j'
// annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
implementation 'org.springframework.boot:spring-boot-starter-actuator'
implementation 'org.springframework.cloud:spring-cloud-starter-config'
implementation 'org.springframework.cloud:spring-cloud-config-client'
// implementation 'org.springframework.cloud:spring-cloud-starter-parent:2020.0.1'
}
you need the "message" property in the properties file