How do you manage external configuration in a distributed system? With Spring Cloud Config you have a central place to manage external configurations for all your environments. In this blog, you will take a closer look at Spring Cloud Config by means of examples. Enjoy!
1. Introduction
Spring Boot applications can be configured by means of external configuration, often an application.properties (or yaml) file. When you have a distributed system or many Spring Boot applications, it can be cumbersome to manage all these files. Probably, you also have different setups for different environments (dev, test, acceptance, prod) which multiplies the number of configurations to manage. Using Spring Cloud Config, you can manage all the configurations in a single location.
In this blog, you will learn how to setup a Spring Cloud Config server and how to manage the configuration files.
Sources used in this blog can be found at GitHub in two repositories:
2. Config Server
First thing to do is to setup the config server. You will need the spring-cloud-config-server dependency for that. Add the following to the pom of the config server (Maven module configserver).
<properties>
...
<spring-cloud.version>2025.1.2</spring-cloud.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-config-server</artifactId>
</dependency>
...
</dependencies>
<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>
The only thing you need to do in order to configure the Spring Boot application as a config server, is to annotate the main class with @EnableConfigServer.
@SpringBootApplication
@EnableConfigServer
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
Next thing to do is to configure the config server in order that it knows where to look for the configuration files. There are numerous options available, which are documented in the official documentation. In this blog, you will point it to a git repository which contains the configuration files. Spring Cloud Config will use the main branch as default, so if you want to change that, you set the default-label property. The port is defaulted to 8888, which is made explicit in the config below.
spring.application.name=configserver
spring.cloud.config.server.git.uri=https://github.com/mydeveloperplanet/MySpringCloudConfigProperties
spring.cloud.config.server.git.default-label=master
server.port=8888
Start the config server.
mvn spring-boot:run
In the properties git repository, two config files are added in the root of the repository. The name of these config files is the Spring application name of the client (which will be created in the next paragraph) and a prod and test config.
- configclient-prod.properties
- configclient-test.properties
In order to verify whether the config server works as expected, you can invoke the URL for retrieving the prod properties of the configclient. It returns the contents of this file.
$ curl http://localhost:8888/configclient/prod/master
{"name":"configclient","profiles":["prod"],"label":"master","version":"aadb1e3620774cc0450e97fbc36c458b69581adf","state":"","propertySources":[{"name":"https://github.com/mydeveloperplanet/MySpringCloudConfigProperties/configclient-prod.properties","source":{"app.greeting":"Hi prod property!"}}]}
You can do the same for the test properties.
$ curl http://localhost:8888/configclient/test/master
{"name":"configclient","profiles":["test"],"label":"master","version":"aadb1e3620774cc0450e97fbc36c458b69581adf","state":"","propertySources":[{"name":"https://github.com/mydeveloperplanet/MySpringCloudConfigProperties/configclient-test.properties","source":{"app.greeting":"Hi test property!"}}]}
3. Config Client
Now that the config server has been setup, it is time to create a client. The client is a basic Spring Boot MVC application. In order to make use of the config server, you need to add the spring-cloud-starter-config dependency.
<properties>
<spring-cloud.version>2025.1.2</spring-cloud.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-config</artifactId>
</dependency>
...
</dependencies>
<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>
Create a basic configuration record ApplicationConfig which contains a simple property for a greeting message. The configuration is created as a record in order to make the configuration immutable, which is a good thing to do. Also annotate the main class with @ConfigurationPropertiesScan("com.mydeveloperplanet.myspringcloudconfigplanet.config"). This will limit the search scope to the config package.
@ConfigurationProperties("app")
public record ApplicationConfig(String greeting) {
}
The controller injects the configuration and provides an endpoint for retrieving the greeting message.
@RestController
class ApplicationController {
private ApplicationConfig applicationConfig;
ApplicationController(ApplicationConfig applicationConfig) {
this.applicationConfig = applicationConfig;
}
@GetMapping("/greeting")
public String getGreeting() {
return applicationConfig.greeting();
}
}
Now you need to ensure that the client knows where to find the configuration files. Therefore, a minimal local configuration file is needed.
- you define the Spring application name, this is the name used to find the correct configuration file (the first part of it);
- you specify which Spring profile should be used (test or prod);
- you specify which branch of the configuration should be used (it defaulted in the config server to the master branch, but if you want to make it more explicit, you can add it here also);
- you specify the location of the config server (
optionalwill be explained later on).
spring.application.name=configclient
spring.profiles.active=prod
spring.cloud.config.label=master
spring.config.import=optional:configserver:http://localhost:8888/
Start the client.
mvn spring-boot:run
Test the endpoint. The contents of the property of clientconfig-prod.properties is returned.
$ curl http://localhost:8080/greeting
Hi prod property!
Stop the client and change the spring.profiles.active property to test.
spring.profiles.active=test
Start the client, test the endpoint again. The contents of the property of clientconfig-test.properties is returned.
$ curl http://localhost:8080/greeting
Hi test property!
Stop the client and set the following properties in comment.
#spring.profiles.active=test
#spring.cloud.config.label=master
Start the client and invoke the endpoint again. Nothing is returned. Reason for this, is that the config server will search for a configclient.properties file in the git repository, and this one does not exist.
4. Optional Keyword
In the client, you set up the location of the config server. In this setup, a keyword optional was used.
spring.config.import=optional:configserver:http://localhost:8888/
Turn off the config server and start the client again. In the logs of the client you will see warnings about not being able to connect to the config server, but the client starts. This is what optional is doing, it will not fail when no configuration could be retrieved.
2026-08-01T14:23:38.330+02:00 INFO 229693 --- [configclient] [ main] o.s.c.c.c.ConfigServerConfigDataLoader : Fetching config from server at : http://localhost:8888/
2026-08-01T14:23:38.331+02:00 INFO 229693 --- [configclient] [ main] o.s.c.c.c.ConfigServerConfigDataLoader : Exception on Url - http://localhost:8888/:org.springframework.web.client.ResourceAccessException: I/O error on GET request for "http://localhost:8888/configclient/default/master": Connection refused. Will be trying the next url if available
2026-08-01T14:23:38.331+02:00 WARN 229693 --- [configclient] [ main] o.s.c.c.c.ConfigServerConfigDataLoader : Could not locate PropertySource ([ConfigServerConfigDataResource@68d6972f uris = array<String>['http://localhost:8888/'], optional = true, profiles = 'default']): I/O error on GET request for "http://localhost:8888/configclient/default/master": Connection refused
2026-08-01T14:23:38.331+02:00 INFO 229693 --- [configclient] [ main] o.s.c.c.c.ConfigServerConfigDataLoader : Fetching config from server at : http://localhost:8888/
2026-08-01T14:23:38.331+02:00 INFO 229693 --- [configclient] [ main] o.s.c.c.c.ConfigServerConfigDataLoader : Exception on Url - http://localhost:8888/:org.springframework.web.client.ResourceAccessException: I/O error on GET request for "http://localhost:8888/configclient/test/master": Connection refused. Will be trying the next url if available
2026-08-01T14:23:38.331+02:00 WARN 229693 --- [configclient] [ main] o.s.c.c.c.ConfigServerConfigDataLoader : Could not locate PropertySource ([ConfigServerConfigDataResource@2a39fe6a uris = array<String>['http://localhost:8888/'], optional = true, profiles = 'test']): I/O error on GET request for "http://localhost:8888/configclient/test/master": Connection refused
2026-08-01T14:23:38.331+02:00 INFO 229693 --- [configclient] [ main] o.s.c.c.c.ConfigServerConfigDataLoader : Fetching config from server at : http://localhost:8888/
2026-08-01T14:23:38.331+02:00 INFO 229693 --- [configclient] [ main] o.s.c.c.c.ConfigServerConfigDataLoader : Exception on Url - http://localhost:8888/:org.springframework.web.client.ResourceAccessException: I/O error on GET request for "http://localhost:8888/configclient/default/master": Connection refused. Will be trying the next url if available
2026-08-01T14:23:38.331+02:00 WARN 229693 --- [configclient] [ main] o.s.c.c.c.ConfigServerConfigDataLoader : Could not locate PropertySource ([ConfigServerConfigDataResource@410ae9a3 uris = array<String>['http://localhost:8888/'], optional = true, profiles = 'default']): I/O error on GET request for "http://localhost:8888/configclient/default/master": Connection refused
2026-08-01T14:23:38.581+02:00 INFO 229693 --- [configclient] [ main] o.s.cloud.context.scope.GenericScope : BeanFactory id=fadf65e6-2c5c-3610-a15e-b2961684bf27
It might be that you do not want this behaviour because it could leave your client in an undefined state. In that case, you remove optional.
spring.config.import=configserver:http://localhost:8888/
Restart the client, and now it fails starting up.
14:25:03.161 [main] ERROR org.springframework.boot.SpringApplication -- Application run failed
org.springframework.cloud.config.client.ConfigClientFailFastException: Could not locate PropertySource and the resource is not optional, failing
at org.springframework.cloud.config.client.ConfigServerConfigDataLoader.doLoad(ConfigServerConfigDataLoader.java:218)
at org.springframework.cloud.config.client.ConfigServerConfigDataLoader.load(ConfigServerConfigDataLoader.java:106)
at org.springframework.cloud.config.client.ConfigServerConfigDataLoader.load(ConfigServerConfigDataLoader.java:63)
at org.springframework.boot.context.config.ConfigDataLoaders.load(ConfigDataLoaders.java:100)
at org.springframework.boot.context.config.ConfigDataImporter.load(ConfigDataImporter.java:133)
at org.springframework.boot.context.config.ConfigDataImporter.resolveAndLoad(ConfigDataImporter.java:88)
at org.springframework.boot.context.config.ConfigDataEnvironmentContributors.withProcessedImports(ConfigDataEnvironmentContributors.java:130)
at org.springframework.boot.context.config.ConfigDataEnvironment.processInitial(ConfigDataEnvironment.java:253)
at org.springframework.boot.context.config.ConfigDataEnvironment.processAndApply(ConfigDataEnvironment.java:240)
at org.springframework.boot.context.config.ConfigDataEnvironmentPostProcessor.postProcessEnvironment(ConfigDataEnvironmentPostProcessor.java:97)
at org.springframework.boot.context.config.ConfigDataEnvironmentPostProcessor.postProcessEnvironment(ConfigDataEnvironmentPostProcessor.java:90)
at org.springframework.boot.support.EnvironmentPostProcessorApplicationListener.onApplicationEnvironmentPreparedEvent(EnvironmentPostProcessorApplicationListener.java:137)
at org.springframework.boot.support.EnvironmentPostProcessorApplicationListener.onApplicationEvent(EnvironmentPostProcessorApplicationListener.java:120)
at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:180)
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:173)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:151)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:133)
at org.springframework.boot.context.event.EventPublishingRunListener.multicastInitialEvent(EventPublishingRunListener.java:137)
at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:82)
at org.springframework.boot.SpringApplicationRunListeners.lambda$environmentPrepared$0(SpringApplicationRunListeners.java:66)
at java.base/java.util.ImmutableCollections$List12.forEach(ImmutableCollections.java:681)
at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:123)
at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:117)
at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:65)
at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:356)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:316)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1365)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1354)
at com.mydeveloperplanet.myspringcloudconfigplanet.Application.main(Application.java:12)
Caused by: org.springframework.web.client.ResourceAccessException: I/O error on GET request for "http://localhost:8888/configclient/default/master": Connection refused
at org.springframework.web.client.RestTemplate.createResourceAccessException(RestTemplate.java:780)
at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:760)
at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:677)
at org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:561)
at org.springframework.cloud.config.client.ConfigServerConfigDataLoader.getRemoteEnvironment(ConfigServerConfigDataLoader.java:349)
at org.springframework.cloud.config.client.ConfigServerConfigDataLoader.doLoad(ConfigServerConfigDataLoader.java:130)
... 28 common frames omitted
Caused by: java.net.ConnectException: Connection refused
at java.base/sun.nio.ch.Net.pollConnect(Native Method)
at java.base/sun.nio.ch.Net.pollConnectNow(Net.java:639)
at java.base/sun.nio.ch.NioSocketImpl.timedFinishConnect(NioSocketImpl.java:543)
at java.base/sun.nio.ch.NioSocketImpl.connect(NioSocketImpl.java:594)
at java.base/java.net.Socket.connect(Socket.java:659)
at java.base/sun.net.NetworkClient.doConnect(NetworkClient.java:161)
at java.base/sun.net.www.http.HttpClient.openServer(HttpClient.java:516)
at java.base/sun.net.www.http.HttpClient.openServer(HttpClient.java:604)
at java.base/sun.net.www.http.HttpClient.<init>(HttpClient.java:276)
at java.base/sun.net.www.http.HttpClient.New(HttpClient.java:380)
at java.base/sun.net.www.http.HttpClient.New(HttpClient.java:393)
at java.base/sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1030)
at java.base/sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:963)
at java.base/sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:899)
at java.base/sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:872)
at org.springframework.http.client.SimpleClientHttpRequest.executeInternal(SimpleClientHttpRequest.java:80)
at org.springframework.http.client.AbstractStreamingClientHttpRequest.executeInternal(AbstractStreamingClientHttpRequest.java:87)
at org.springframework.http.client.AbstractClientHttpRequest.execute(AbstractClientHttpRequest.java:80)
at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:754)
... 32 common frames omitted
5. Dynamic Reloading Properties
When a property is changed in the configuration git repository, this change is not automatically visible in the client. You need to restart the client for that. If you want to be able to dynamically reload properties, you need to annotate the configuration class with @RefreshScope. Do note that configuration class is mentioned here and not configuration record. A record is immutable and cannot be changed. So you will need to create a class for that purpose. Create a separate ApplicationRefreshConfig class.
@RefreshScope
@ConfigurationProperties("apprefresh")
public class ApplicationRefreshConfig {
private String greeting;
public String getGreeting() {
return greeting;
}
public void setGreeting(String greeting) {
this.greeting = greeting;
}
}
Add an extra endpoint to the controller.
@RestController
class ApplicationController {
private ApplicationConfig applicationConfig;
private ApplicationRefreshConfig applicationRefreshConfig;
ApplicationController(ApplicationConfig applicationConfig, ApplicationRefreshConfig applicationRefreshConfig) {
this.applicationConfig = applicationConfig;
this.applicationRefreshConfig = applicationRefreshConfig;
}
@GetMapping("/greeting")
public String getGreeting() {
return applicationConfig.greeting();
}
@GetMapping("/refreshgreeting")
public String getRefreshGreeting() {
return applicationRefreshConfig.getGreeting();
}
}
Add the new property to the property file.
apprefresh.greeting=Hi test refresh!
In order to be able to dynamically reload properties, you need to add Spring Boot Actuator to the pom. This way, you are able to invoke the actuator refresh endpoint which will reload the properties.
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
Start the client and invoke the new endpoint.
$ curl http://localhost:8080/refreshgreeting
Hi test refresh!
Change in the configuration git repository the greeting message.
apprefresh.greeting=Hi test refresh, changed property content!
Invoke the endpoint again, as you can see, nothing has changed.
$ curl http://localhost:8080/refreshgreeting
Hi test refresh!
Invoke the actuator refresh endpoint: http://localhost:8080/actuator/refresh
Invoke the refresh greeting endpoint again.
$ curl http://localhost:8080/refreshgreeting
Nothing is returned and an exception occurs in the client. Spring Boot will try to refresh the configuration record also, and this is not possible because it is a record.
2026-08-01T14:47:24.892+02:00 WARN 232291 --- [configclient] [nio-8080-exec-1] .s.c.c.p.ConfigurationPropertiesRebinder : Cannot create default instance of com.mydeveloperplanet.myspringcloudconfigplanet.config.ApplicationConfig for reset; skipping property reset
org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.mydeveloperplanet.myspringcloudconfigplanet.config.ApplicationConfig]: Illegal arguments for constructor
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:217) ~[spring-beans-7.0.8.jar:7.0.8]
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:149) ~[spring-beans-7.0.8.jar:7.0.8]
at org.springframework.cloud.context.properties.ConfigurationPropertiesRebinder.resetBeanToDefaults(ConfigurationPropertiesRebinder.java:192) ~[spring-cloud-context-5.0.2.jar:5.0.2]
at org.springframework.cloud.context.properties.ConfigurationPropertiesRebinder.rebind(ConfigurationPropertiesRebinder.java:167) ~[spring-cloud-context-5.0.2.jar:5.0.2]
at org.springframework.cloud.context.properties.ConfigurationPropertiesRebinder.rebind(ConfigurationPropertiesRebinder.java:111) ~[spring-cloud-context-5.0.2.jar:5.0.2]
at org.springframework.cloud.context.properties.ConfigurationPropertiesRebinder.rebind(ConfigurationPropertiesRebinder.java:99) ~[spring-cloud-context-5.0.2.jar:5.0.2]
at org.springframework.cloud.context.properties.ConfigurationPropertiesRebinder.onApplicationEvent(ConfigurationPropertiesRebinder.java:261) ~[spring-cloud-context-5.0.2.jar:5.0.2]
at org.springframework.cloud.context.properties.ConfigurationPropertiesRebinder.onApplicationEvent(ConfigurationPropertiesRebinder.java:65) ~[spring-cloud-context-5.0.2.jar:5.0.2]
at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:180) ~[spring-context-7.0.8.jar:7.0.8]
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:173) ~[spring-context-7.0.8.jar:7.0.8]
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:151) ~[spring-context-7.0.8.jar:7.0.8]
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:448) ~[spring-context-7.0.8.jar:7.0.8]
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:381) ~[spring-context-7.0.8.jar:7.0.8]
at org.springframework.cloud.context.refresh.ContextRefresher.refreshEnvironment(ContextRefresher.java:103) ~[spring-cloud-context-5.0.2.jar:5.0.2]
at org.springframework.cloud.context.refresh.ContextRefresher.refresh(ContextRefresher.java:94) ~[spring-cloud-context-5.0.2.jar:5.0.2]
at org.springframework.cloud.endpoint.RefreshEndpoint.refresh(RefreshEndpoint.java:46) ~[spring-cloud-context-5.0.2.jar:5.0.2]
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104) ~[na:na]
at java.base/java.lang.reflect.Method.invoke(Method.java:565) ~[na:na]
at org.springframework.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:281) ~[spring-core-7.0.8.jar:7.0.8]
at org.springframework.boot.actuate.endpoint.invoke.reflect.ReflectiveOperationInvoker.invoke(ReflectiveOperationInvoker.java:76) ~[spring-boot-actuator-4.1.0.jar:4.1.0]
at org.springframework.boot.actuate.endpoint.annotation.AbstractDiscoveredOperation.invoke(AbstractDiscoveredOperation.java:62) ~[spring-boot-actuator-4.1.0.jar:4.1.0]
at org.springframework.boot.webmvc.actuate.endpoint.web.AbstractWebMvcEndpointHandlerMapping$ServletWebOperationAdapter.handle(AbstractWebMvcEndpointHandlerMapping.java:347) ~[spring-boot-webmvc-4.1.0.jar:4.1.0]
at org.springframework.boot.webmvc.actuate.endpoint.web.AbstractWebMvcEndpointHandlerMapping$OperationHandler.handle(AbstractWebMvcEndpointHandlerMapping.java:476) ~[spring-boot-webmvc-4.1.0.jar:4.1.0]
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104) ~[na:na]
at java.base/java.lang.reflect.Method.invoke(Method.java:565) ~[na:na]
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:252) ~[spring-web-7.0.8.jar:7.0.8]
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:184) ~[spring-web-7.0.8.jar:7.0.8]
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:117) ~[spring-webmvc-7.0.8.jar:7.0.8]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:934) ~[spring-webmvc-7.0.8.jar:7.0.8]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:853) ~[spring-webmvc-7.0.8.jar:7.0.8]
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:86) ~[spring-webmvc-7.0.8.jar:7.0.8]
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:963) ~[spring-webmvc-7.0.8.jar:7.0.8]
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:866) ~[spring-webmvc-7.0.8.jar:7.0.8]
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1000) ~[spring-webmvc-7.0.8.jar:7.0.8]
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:903) ~[spring-webmvc-7.0.8.jar:7.0.8]
at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:649) ~[tomcat-embed-core-11.0.22.jar:6.1]
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:874) ~[spring-webmvc-7.0.8.jar:7.0.8]
at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:710) ~[tomcat-embed-core-11.0.22.jar:6.1]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:128) ~[tomcat-embed-core-11.0.22.jar:11.0.22]
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) ~[tomcat-embed-websocket-11.0.22.jar:11.0.22]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:107) ~[tomcat-embed-core-11.0.22.jar:11.0.22]
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) ~[spring-web-7.0.8.jar:7.0.8]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) ~[spring-web-7.0.8.jar:7.0.8]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:107) ~[tomcat-embed-core-11.0.22.jar:11.0.22]
at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) ~[spring-web-7.0.8.jar:7.0.8]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) ~[spring-web-7.0.8.jar:7.0.8]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:107) ~[tomcat-embed-core-11.0.22.jar:11.0.22]
at org.springframework.web.filter.ServerHttpObservationFilter.doFilterInternal(ServerHttpObservationFilter.java:110) ~[spring-web-7.0.8.jar:7.0.8]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) ~[spring-web-7.0.8.jar:7.0.8]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:107) ~[tomcat-embed-core-11.0.22.jar:11.0.22]
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:199) ~[spring-web-7.0.8.jar:7.0.8]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) ~[spring-web-7.0.8.jar:7.0.8]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:107) ~[tomcat-embed-core-11.0.22.jar:11.0.22]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:165) ~[tomcat-embed-core-11.0.22.jar:11.0.22]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:77) ~[tomcat-embed-core-11.0.22.jar:11.0.22]
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:492) ~[tomcat-embed-core-11.0.22.jar:11.0.22]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:113) ~[tomcat-embed-core-11.0.22.jar:11.0.22]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:83) ~[tomcat-embed-core-11.0.22.jar:11.0.22]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:72) ~[tomcat-embed-core-11.0.22.jar:11.0.22]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:341) ~[tomcat-embed-core-11.0.22.jar:11.0.22]
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:397) ~[tomcat-embed-core-11.0.22.jar:11.0.22]
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:63) ~[tomcat-embed-core-11.0.22.jar:11.0.22]
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:1272) ~[tomcat-embed-core-11.0.22.jar:11.0.22]
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1801) ~[tomcat-embed-core-11.0.22.jar:11.0.22]
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:52) ~[tomcat-embed-core-11.0.22.jar:11.0.22]
at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:946) ~[tomcat-embed-core-11.0.22.jar:11.0.22]
at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:480) ~[tomcat-embed-core-11.0.22.jar:11.0.22]
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:57) ~[tomcat-embed-core-11.0.22.jar:11.0.22]
at java.base/java.lang.Thread.run(Thread.java:1474) ~[na:na]
Caused by: java.lang.IllegalArgumentException: wrong number of arguments: 0 expected: 1
at java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:59) ~[na:na]
at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499) ~[na:na]
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:483) ~[na:na]
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:207) ~[spring-beans-7.0.8.jar:7.0.8]
... 68 common frames omitted
This can be solved by excluding this configuration file in the local application.properties.
spring.cloud.refresh.never-refreshable=com.mydeveloperplanet.myspringcloudconfigplanet.config.ApplicationConfig
If you now repeat the steps above, the refresh greeting endpoint will return the new value. In the client logs, you can clearly see that the new content has been reloaded.
2026-08-01T14:52:50.175+02:00 INFO 232625 --- [configclient] [nio-8080-exec-3] o.s.c.c.c.ConfigServerConfigDataLoader : Fetching config from server at : http://localhost:8888/
2026-08-01T14:52:50.954+02:00 INFO 232625 --- [configclient] [nio-8080-exec-3] o.s.c.c.c.ConfigServerConfigDataLoader : Located environment: name=configclient, profiles=[default], label=master, version=b6cef433012d85810561443b0ed9adea543fad63, state=
2026-08-01T14:52:50.957+02:00 INFO 232625 --- [configclient] [nio-8080-exec-3] o.s.c.c.c.ConfigServerConfigDataLoader : Fetching config from server at : http://localhost:8888/
2026-08-01T14:52:51.367+02:00 INFO 232625 --- [configclient] [nio-8080-exec-3] o.s.c.c.c.ConfigServerConfigDataLoader : Located environment: name=configclient, profiles=[test], label=master, version=b6cef433012d85810561443b0ed9adea543fad63, state=
2026-08-01T14:52:51.400+02:00 INFO 232625 --- [configclient] [nio-8080-exec-3] o.s.cloud.endpoint.RefreshEndpoint : Refreshed keys : [config.client.version, apprefresh.greeting]
6. Conclusion
Using Spring Cloud Config for maintaining your application properties is fairly easy to setup. This is definitely something to consider when you need to maintain several property files for different applications and environments.
Discover more from My Developer Planet
Subscribe to get the latest posts sent to your email.

Leave a Reply