javaspring-bootspring-boot-actuatorspring-cloud-configspring-cloud-config-server

cannot update value config server using actruator refresh


i have problem when i try to refresh my config server on git using actuator/refresh

this is denpedencies i used in my config client

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
    implementation 'org.springframework.boot:spring-boot-starter-web'
    implementation 'org.springframework.cloud:spring-cloud-starter-bootstrap:4.1.1'
    implementation 'org.springframework.cloud:spring-cloud-starter-config'
    implementation 'org.springframework.cloud:spring-cloud-config-client'
    implementation 'org.springframework.cloud:spring-cloud-bus-dependencies:4.1.0'
    implementation 'org.springframework.boot:spring-boot-starter-actuator'x
    testImplementation 'org.springframework.boot:spring-boot-starter-test'
//  implementation 'org.springframework.cloud:spring-cloud-bus'
}

this is my application properties in my config client

spring.application.name=transfer
server.port=8081
spring.config.import=optional:configserver:http://localhost:8888
spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration
spring.profiles.active=prod
management.endpoints.web.exposure.include=*
endpoints.actuator.enabled=true
spring.cloud.config.enabled=true
management.endpoint.env.post.enabled=true
management.endpoint.restart.enabled=true

and this is my controller to get cloud server using cloud config

@RestController
@RefreshScope
public class TransferController {


    @Value("${maintenance}")
    private String value;



    @GetMapping("/value")
    public String maintenanceConfig(){
        return value;
    }


}

and this is my application properties in the GIT "transfer-prod.properties"

message=transfer.prod 
maintenance=false new

when i try to change value maintenance on the transfer-prod.properties and then hit localhost:8081/actuator/refresh, the response only

[
    "config.client.version"
]

what i expected is [ "config.client.version", "maintenance" ]

does anyone know why? i need help thx


Solution

  • According to documentation you should send post request with content application/json and body {}:

    $ curl localhost:8080/actuator/refresh -d {} -H "Content-Type: application/json"
    

    and you send get request, if I not mistaken