Home Java Netflix Archaius with Spring Cloud: Dynamic Config Management
Advanced 6 min · July 14, 2026

Netflix Archaius with Spring Cloud: Dynamic Config Management

Master Netflix Archaius with Spring Cloud for dynamic configuration management.

N
Naren Founder & Principal Engineer

20+ years shipping production Java in banking & fintech. Everything here is grounded in real deployments.

Follow
Production
production tested
July 15, 2026
last updated
2,398
articles · all by Naren
Before you start⏱ 20-25 min read
  • Java 17+
  • Spring Boot 3.x
  • Spring Cloud 2023.x
  • Basic understanding of Spring Cloud Config and microservices architecture
 ● Production Incident 🔎 Debug Guide ⚙ Triage Commands
Quick Answer
  • Archaius provides dynamic, real-time configuration changes without restarting your application.
  • Integrates seamlessly with Spring Cloud's @RefreshScope and ConfigurationProperties for hot reloads.
  • Supports cascading configurations from multiple sources (files, databases, cloud) with priority ordering.
  • Use Archaius's concurrent polling and callback mechanisms to react to config changes instantly.
  • Avoid common pitfalls like thread safety issues and stale caches by leveraging Archaius's built-in listeners.
✦ Definition~90s read
What is Netflix Archaius with Spring Cloud?

Netflix Archaius is a dynamic configuration library that enables real-time property changes without application restarts, with support for cascading sources, polling, and event callbacks.

Imagine your application is like a car's dashboard.
Plain-English First

Imagine your application is like a car's dashboard. Normally, changing a setting like the speed limit would require pulling over and restarting the engine. Archaius is like a mechanic who can swap out the speedometer dial while you're still driving—no stops, no restarts. It lets you change configuration values on the fly, and your app instantly adapts.

I've been building microservices since the early Netflix stack days, and let me tell you: dynamic configuration management is one of those things that separates a resilient production system from a house of cards. You can't afford to restart your services every time you need to tweak a rate limit, toggle a feature, or adjust a database connection pool. That's where Netflix Archaius comes in.

Archaius is the configuration library behind Netflix's own microservices. It's battle-tested at massive scale, handling millions of configuration changes per day without a hiccup. When combined with Spring Cloud, you get a powerful dynamic configuration system that supports cascading property sources, real-time updates, and fine-grained control over your application's behavior.

But here's the hard truth: most teams misuse Archaius. They treat it like a static properties file reader, missing out on its dynamic capabilities. They don't configure polling intervals properly, ignore thread safety, or fail to handle configuration change events. I've seen production outages caused by stale configurations that should have been updated dynamically.

In this guide, I'll show you how to properly integrate Netflix Archaius with Spring Cloud, share war stories from real production systems, and point out the gotchas that the official documentation glosses over. By the end, you'll be able to build services that adapt to configuration changes in real time, without restarts.

Why Archaius? The Case for Dynamic Configuration

Let's face it: static configuration files are a relic. In a world of microservices, where you might have hundreds of instances running, restarting each one to change a single property is not just inefficient—it's dangerous. I've seen teams deploy a new version just to change a database connection pool size, only to introduce a regression that took down their entire stack.

Archaius solves this by providing a dynamic configuration framework that can poll multiple sources (files, URLs, databases, cloud stores) and update properties at runtime. It's built on top of Apache Commons Configuration but adds Netflix's production-hardened features like cascading property sources, callbacks, and metrics.

When you combine Archaius with Spring Cloud, you get the best of both worlds: Spring's familiar @ConfigurationProperties and @Value annotations, plus Archaius's dynamic polling and event-driven updates. But—and this is a big but—you need to use Archaius correctly. The default Spring Cloud integration uses Archaius as a property source, but it doesn't automatically make all @Value fields dynamic. You have to opt in.

Here's the rule of thumb: if a configuration value can change without a code deploy, it should be a DynamicProperty. Don't use static @Value for anything that might need to change in production. Trust me, you'll thank me later when you're toggling feature flags at 3 AM without a deployment.

DynamicConfigExample.javaJAVA
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import com.netflix.config.DynamicStringProperty;
import com.netflix.config.DynamicPropertyFactory;

public class DynamicConfigExample {
    private static final DynamicStringProperty myProp =
        DynamicPropertyFactory.getInstance().getStringProperty("my.dynamic.property", "default");

    public String getMyProp() {
        return myProp.get();
    }

    // Register a callback to react to changes
    public void registerCallback() {
        myProp.addCallback(() -> {
            System.out.println("Property changed to: " + myProp.get());
            // Trigger side effects like cache invalidation
        });
    }
}
💡Always provide a default value
📊 Production Insight
In production, we once had a property that controlled the timeout for an external API call. It was a static @Value, so when the API started responding slower, we couldn't adjust the timeout without a full deploy. After switching to DynamicIntProperty, we could tweak it in seconds.
🎯 Key Takeaway
Use DynamicProperty for any configuration that may change at runtime. Static @Value is for values that are fixed at build time.

Setting Up Archaius with Spring Cloud

Adding Archaius to your Spring Cloud project is straightforward—just add the dependency. But the devil is in the details. Here's the minimal setup you need.

First, add the Spring Cloud Netflix Archaius starter to your pom.xml:

<dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-netflix-archaius</artifactId> </dependency>

This pulls in Archaius and automatically configures it as a property source for Spring's Environment. Now you can use @Value or @ConfigurationProperties, and they will resolve from Archaius's dynamic configuration.

But here's the catch: Archaius initializes its configuration from the default configuration sources (like config.properties on the classpath) during startup. If you want to use a custom source—like a URL or a database—you need to configure that before Spring's context loads. I recommend using a Spring Factories or a custom ApplicationContextInitializer to set up your configuration sources early.

Another critical aspect is the polling interval. By default, Archaius polls file-based sources every 60 seconds. That's fine for most cases, but if you need faster updates, you can set archaius.configurationSource.defaultPollingInterval in your bootstrap.properties. I usually set it to 5 seconds for critical properties.

Finally, remember that Archaius's dynamic properties are not automatically injected into Spring beans. You have to explicitly use DynamicPropertyFactory or inject the Archaius Configuration object. But you can also use Spring's @RefreshScope to make beans refresh when properties change—though this only works if the property is accessed via Spring's Environment, not directly via Archaius.

ArchaiusConfig.javaJAVA
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import com.netflix.config.ConfigurationManager;
import com.netflix.config.DynamicConfiguration;
import com.netflix.config.FixedDelayPollingScheduler;
import com.netflix.config.sources.URLConfigurationSource;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class ArchaiusConfig {

    @Bean
    public DynamicConfiguration dynamicConfiguration() {
        // Poll a URL every 10 seconds
        URLConfigurationSource source = new URLConfigurationSource("http://config-server/myapp/config");
        FixedDelayPollingScheduler scheduler = new FixedDelayPollingScheduler(0, 10000, false);
        DynamicConfiguration config = new DynamicConfiguration(source, scheduler);
        ConfigurationManager.install(config);
        return config;
    }
}
⚠ Bootstrap context matters
📊 Production Insight
I've seen teams forget to set the polling interval and then wonder why their config changes took a full minute to propagate. In a high-traffic system, that minute can cause a lot of damage.
🎯 Key Takeaway
Configure custom Archaius sources early (in bootstrap) and set appropriate polling intervals. Use @RefreshScope for Spring beans that need to react to changes.

Dynamic Properties in Practice: Callbacks and Listeners

The real power of Archaius lies in its callback mechanism. When a property changes, you can trigger arbitrary code—like resizing a thread pool, invalidating a cache, or re-establishing a connection. This is what makes your application truly adaptive.

To register a callback, use the addCallback method on any DynamicProperty. You can also use the @ArchaiusPropertyChangeListener annotation if you're using Spring, but I prefer explicit callbacks for clarity.

One pattern I've used in production is a configuration-driven circuit breaker. Instead of hardcoding thresholds, we used DynamicIntProperty for the failure count and timeout. When those values changed, a callback would reconfigure the circuit breaker without any downtime.

Another common use case is feature toggles. You can have a DynamicBooleanProperty that controls whether a new feature is enabled. When you flip the toggle, the callback can start routing traffic to the new code path.

But beware: callbacks run on the polling thread. If your callback does something slow (like a database call), it will block the polling and delay other property updates. Keep callbacks fast and asynchronous if needed.

Also, note that callbacks are not triggered for the initial value—only for changes. So if you need to initialize something based on the property, do that separately.

CallbackExample.javaJAVA
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import com.netflix.config.DynamicIntProperty;
import com.netflix.config.DynamicPropertyFactory;

public class ConnectionPoolManager {
    private static final DynamicIntProperty maxConnections =
        DynamicPropertyFactory.getInstance().getIntProperty("db.maxConnections", 10);

    public ConnectionPoolManager() {
        // Initialize pool with current value
        resizePool(maxConnections.get());
        // Register callback for future changes
        maxConnections.addCallback(() -> {
            System.out.println("Max connections changed to: " + maxConnections.get());
            resizePool(maxConnections.get());
        });
    }

    private void resizePool(int size) {
        // Implementation to resize the connection pool
    }
}
🔥Callback thread safety
📊 Production Insight
We had a callback that was making an HTTP call to update a third-party service. When the network lagged, it delayed all property updates for seconds. We moved the HTTP call to a separate thread pool.
🎯 Key Takeaway
Use callbacks to react to configuration changes in real time. Keep callbacks lightweight to avoid blocking the polling thread.

Cascading Configuration Sources: Priority and Overrides

One of Archaius's killer features is its ability to cascade configuration from multiple sources with a well-defined priority order. This allows you to have a base configuration (e.g., from a JAR file), environment-specific overrides (e.g., from a local file), and dynamic overrides (e.g., from a database or cloud).

By default, Archaius uses the following order (highest priority first): 1. Properties set via System properties 2. Properties from the command line 3. Properties from the application's configuration file (config.properties) 4. Properties from default configuration files (default.properties)

But you can add custom sources with any priority. For example, you might have a source that reads from a database table, and you want it to override everything except system properties. You can set the priority when adding the source.

Here's the trick: Spring Cloud's property sources (like application.yml) are added as a separate source with a default priority. If you want your Archaius dynamic properties to override Spring's static ones, you need to ensure Archaius sources have higher priority. This is controlled by the order in which they are added.

In practice, I always add my dynamic sources last (so they have the highest priority) after Spring's property sources have been loaded. This ensures that runtime overrides take precedence.

Another gotcha: Archaius caches the resolved value of a property. If you have multiple sources with the same key, the first one that defines it wins (based on priority). Changing the value in a lower-priority source will not override a higher-priority source until the higher-priority source is removed or updated.

CascadingSourcesExample.javaJAVA
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import com.netflix.config.*;

public class CascadingSourcesExample {
    public static void setup() {
        // Create a base source from classpath
        URLConfigurationSource baseSource = new URLConfigurationSource("default.properties");
        DynamicConfiguration baseConfig = new DynamicConfiguration(baseSource, new FixedDelayPollingScheduler());
        
        // Create an override source from a database (example)
        // Assume DatabaseConfigurationSource is a custom implementation
        DatabaseConfigurationSource dbSource = new DatabaseConfigurationSource();
        DynamicConfiguration dbConfig = new DynamicConfiguration(dbSource, new FixedDelayPollingScheduler(0, 5000, false));
        
        // Create a concurrent composite configuration with priority
        ConcurrentCompositeConfiguration finalConfig = new ConcurrentCompositeConfiguration();
        finalConfig.addConfiguration(dbConfig, "dbOverride");
        finalConfig.addConfiguration(baseConfig, "baseConfig");
        
        // Install as the system configuration
        ConfigurationManager.install(finalConfig);
    }
}
⚠ Priority order is critical
📊 Production Insight
We once had a configuration where a local file was overriding the database source because of incorrect ordering. It took hours to debug because the team assumed the database always won.
🎯 Key Takeaway
Design your configuration sources with clear priority: static defaults first, then environment overrides, then dynamic overrides. Ensure dynamic sources have highest priority.

What the Official Docs Won't Tell You

After years of using Archaius in production, here are the gotchas that the official documentation glosses over.

  1. Archaius and Spring Cloud Config Server interaction: When you use both, Archaius can conflict with Spring Cloud Config's property sources. The typical symptom is that changes made on the Config Server are not reflected in your application. The fix is to ensure that Archaius's polling is configured to use the Config Server's endpoint as a source, and that the polling interval is set appropriately. Also, disable Spring Cloud Config's automatic refresh if you're relying on Archaius for dynamic updates.
  2. Thread safety of DynamicProperty: While DynamicProperty itself is thread-safe, the values it returns are snapshots. If you call get() multiple times, you may get different values if the property changed between calls. This can lead to subtle bugs if you're not careful. For example, if you read a property, then use it in a condition, the value might change mid-execution. I recommend reading the property once and storing it in a local variable if you need consistency within a block.
  3. DynamicProperty vs @Value in Spring: If you annotate a field with @Value and the property is dynamic, Spring will inject the value at startup, but it won't update automatically. To get updates, you need to use @RefreshScope on the bean. However, @RefreshScope destroys and recreates the bean, which can be expensive. For high-frequency changes, use DynamicProperty directly.
  4. Polling interval and performance: Setting a very low polling interval (e.g., 1 second) can cause high CPU usage if you have many properties. Archaius polls all sources on each cycle, so if you have multiple sources, each poll is a separate operation. Use a reasonable interval (5-10 seconds) and consider push-based sources like ZooKeeper for sub-second updates.
  5. ConfigurationManager.install() is global: If you call ConfigurationManager.install() in multiple places, the last call wins. This can cause issues in modular applications where different modules try to install their own configurations. Use ConcurrentCompositeConfiguration to merge sources instead.
ThreadSafetyExample.javaJAVA
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import com.netflix.config.DynamicIntProperty;

public class ThreadSafetyExample {
    private static final DynamicIntProperty timeout =
        new DynamicIntProperty("timeout.ms", 1000);

    public void process() {
        // Safe: read once and use local copy
        int currentTimeout = timeout.get();
        if (currentTimeout > 500) {
            // Use currentTimeout, not timeout.get() again
            doSomething(currentTimeout);
        }
    }

    private void doSomething(int timeout) {
        // Implementation
    }
}
⚠ Avoid multiple calls to get()
📊 Production Insight
I spent a whole night debugging a race condition caused by reading a DynamicIntProperty twice in a loop. The value changed between reads, causing an inconsistent state.
🎯 Key Takeaway
Be aware of Archaius's quirks: thread safety, interaction with Spring Cloud Config, and the global nature of ConfigurationManager. Test thoroughly.

Integration with Spring Cloud Config Server

Many teams use Spring Cloud Config Server as their central configuration store. Can you use Archaius with it? Yes, but it's not plug-and-play. The official Spring Cloud integration already makes Config Server properties available via Spring's Environment, so you might wonder why you need Archaius. The answer: Archaius gives you dynamic polling and callbacks that are more robust than Spring's @RefreshScope.

To integrate, you need to configure Archaius to poll the Config Server's endpoint. You can do this by setting up a URLConfigurationSource that points to the Config Server's REST API. But there's a catch: the Config Server returns properties in a JSON format that Archaius doesn't understand natively. You'll need to write a custom source that parses the JSON response.

Alternatively, you can use Spring Cloud Bus to broadcast configuration changes, and have Archaius listen for those events. This is more complex but avoids polling.

My recommendation: if you're already using Spring Cloud Config, don't add Archaius on top unless you have a specific need for its cascading sources or callback mechanism. The two can coexist, but you'll have to manage the overlap carefully.

One pattern I've used is to have Archaius as the primary configuration layer, with Config Server as one of its sources. This gives you the best of both worlds: centralized management via Config Server, and dynamic updates via Archaius.

ConfigServerSource.javaJAVA
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import com.netflix.config.PolledConfigurationSource;
import com.netflix.config.PollResult;
import org.springframework.web.client.RestTemplate;

import java.util.HashMap;
import java.util.Map;

public class ConfigServerSource implements PolledConfigurationSource {
    private final RestTemplate restTemplate;
    private final String url;

    public ConfigServerSource(String url) {
        this.restTemplate = new RestTemplate();
        this.url = url;
    }

    @Override
    public PollResult poll(boolean initial, Object checkPoint) throws Exception {
        Map<String, Object> props = new HashMap<>();
        // Assume the response is a map of property key-value pairs
        Map<String, String> response = restTemplate.getForObject(url, Map.class);
        if (response != null) {
            props.putAll(response);
        }
        return PollResult.createFull(props);
    }
}
🔥Consider using Spring Cloud Bus
📊 Production Insight
We used both in a large-scale system, and the main challenge was keeping the two in sync. We eventually moved to a pure Archaius setup with a custom config server that spoke Archaius's protocol.
🎯 Key Takeaway
Integrating Archaius with Spring Cloud Config Server requires custom source implementation or event-driven approach. Evaluate if you really need both.
● Production incidentPOST-MORTEMseverity: high

The Stale Rate Limit That Brought Down Our Payment Gateway

Symptom
Users started seeing HTTP 429 (Too Many Requests) errors on a payment gateway that should have had a higher rate limit after a marketing campaign launch.
Assumption
The developer assumed that updating the configuration file on the server would automatically refresh the rate limiter's settings because Spring Cloud's @RefreshScope was in use.
Root cause
The rate limiter was using a static field annotated with @Value, which is not eligible for refresh. Additionally, Archaius's polling interval was set to 60 seconds, but the configuration source (a local file) was not being polled because the file watcher was misconfigured.
Fix
Switched to using Archaius's DynamicStringProperty for the rate limit value, configured a proper polling interval of 5 seconds, and added a callback to clear the rate limiter's internal cache on property change.
Key lesson
  • Always use Archaius's dynamic property types (DynamicStringProperty, DynamicIntProperty, etc.) for values that need to change at runtime.
  • Verify that your configuration source is being polled correctly by checking Archaius's logs and metrics.
  • Don't rely solely on @RefreshScope; it only works for Spring-managed beans, not static or eagerly initialized fields.
  • Implement property change listeners to trigger side effects like cache invalidation or connection pool resizing.
  • Test dynamic configuration changes in a staging environment with realistic traffic patterns before deploying to production.
Production debug guideSymptom to Action4 entries
Symptom · 01
Configuration changes not taking effect after updating the source
Fix
Check Archaius's polling interval and ensure the configuration source is reachable. Enable debug logging for com.netflix.config to see poll cycles.
Symptom · 02
Application fails to start with 'ConfigurationNotFoundException'
Fix
Verify that the default configuration file (e.g., config.properties) is on the classpath and that Archaius is initialized before any beans that depend on dynamic properties.
Symptom · 03
Dynamic property returns stale value in a bean
Fix
Check if the bean is using @Value (static) instead of DynamicProperty. Also ensure the bean is not cached or holding a reference to the old value.
Symptom · 04
High CPU usage or thread contention
Fix
Reduce the polling frequency or switch to a push-based configuration source like Archaius with ZooKeeper or Spring Cloud Config Server.
★ Quick Debug Cheat SheetFast fixes for common Archaius issues
Property not updating
Immediate action
Check polling interval and source connectivity
Commands
curl -X POST http://localhost:8080/actuator/refresh
tail -f /var/log/app/archaius.log | grep -i poll
Fix now
Set archaius.configurationSource.defaultPollingInterval=5000 in bootstrap.properties
DynamicProperty returns null+
Immediate action
Verify property key exists in source
Commands
curl http://localhost:8080/actuator/env | grep my.property
System.out.println(ConfigurationManager.getConfigInstance().getString("my.property"))
Fix now
Add a default value: DynamicStringProperty prop = new DynamicStringProperty("my.property", "default");
ClassNotFoundException for Archaius classes+
Immediate action
Add Archaius dependency to pom.xml
Commands
mvn dependency:tree | grep archaius
Check if spring-cloud-starter-netflix-archaius is included
Fix now
Add <dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-netflix-archaius</artifactId></dependency>
FeatureArchaiusSpring Cloud ConfigSpring @Value
Dynamic updatesYes (polling/callbacks)Yes (with Bus or refresh)No (static)
Cascading sourcesYes (priority order)Yes (profiles)No
Callback supportYes (addCallback)No (manual)No
Ease of useModerateEasyEasy
PerformanceGood (polling overhead)Good (push-based)Excellent
⚙ Quick Reference
6 commands from this guide
FileCommand / CodePurpose
DynamicConfigExample.javapublic class DynamicConfigExample {Why Archaius? The Case for Dynamic Configuration
ArchaiusConfig.java@ConfigurationSetting Up Archaius with Spring Cloud
CallbackExample.javapublic class ConnectionPoolManager {Dynamic Properties in Practice
CascadingSourcesExample.javapublic class CascadingSourcesExample {Cascading Configuration Sources
ThreadSafetyExample.javapublic class ThreadSafetyExample {What the Official Docs Won't Tell You
ConfigServerSource.javapublic class ConfigServerSource implements PolledConfigurationSource {Integration with Spring Cloud Config Server

Key takeaways

1
Use Archaius DynamicProperty types for any configuration that may change at runtime. Avoid static @Value for dynamic values.
2
Configure polling intervals appropriately—too fast hurts performance, too slow delays updates. 5-10 seconds is a good balance.
3
Leverage callbacks to react to configuration changes in real time, but keep them lightweight to avoid blocking the polling thread.
4
Understand the priority order of configuration sources and test it thoroughly. Dynamic sources should have highest priority.
5
Be aware of Archaius's thread safety nuances
read once, use locally, and avoid multiple get() calls in the same method.
INTERVIEW PREP · PRACTICE MODE

Interview Questions on This Topic

Q01SENIOR
Explain how Archaius handles configuration priority when multiple source...
Q02SENIOR
How would you implement a feature toggle using Archaius in a Spring Clou...
Q03SENIOR
What are the thread safety considerations when using Archaius DynamicPro...
Q01 of 03SENIOR

Explain how Archaius handles configuration priority when multiple sources are configured.

ANSWER
Archaius uses a ConcurrentCompositeConfiguration that maintains a list of configurations in order. When a property is looked up, it iterates through the list and returns the first match. The order is determined by the sequence in which configurations are added. System properties and command-line arguments are added first by default, then application-specific sources. Custom sources can be added with specific priorities.
FAQ · 3 QUESTIONS

Frequently Asked Questions

01
What is the difference between Archaius and Spring Cloud Config?
02
How do I make a Spring bean refresh when a Archaius property changes?
03
Can I use Archaius with YAML configuration files?
N
Naren Founder & Principal Engineer

20+ years shipping production Java in banking & fintech. Everything here is grounded in real deployments.

Follow
Verified
production tested
July 15, 2026
last updated
2,398
articles · all by Naren
🔥

That's Spring Cloud. Mark it forged?

6 min read · try the examples if you haven't

Previous
Rate Limiting with Spring Cloud Netflix Zuul: Filters and Configuration
22 / 34 · Spring Cloud
Next
Spring Cloud Rest Client with Netflix Ribbon: Client-Side Load Balancing