Partner – Orkes – NPI EA (cat=Spring)
announcement - icon

Modern software architecture is often broken. Slow delivery leads to missed opportunities, innovation is stalled due to architectural complexities, and engineering resources are exceedingly expensive.

Orkes is the leading workflow orchestration platform built to enable teams to transform the way they develop, connect, and deploy applications, microservices, AI agents, and more.

With Orkes Conductor managed through Orkes Cloud, developers can focus on building mission critical applications without worrying about infrastructure maintenance to meet goals and, simply put, taking new products live faster and reducing total cost of ownership.

Try a 14-Day Free Trial of Orkes Conductor today.

Partner – Orkes – NPI EA (tag=Microservices)
announcement - icon

Modern software architecture is often broken. Slow delivery leads to missed opportunities, innovation is stalled due to architectural complexities, and engineering resources are exceedingly expensive.

Orkes is the leading workflow orchestration platform built to enable teams to transform the way they develop, connect, and deploy applications, microservices, AI agents, and more.

With Orkes Conductor managed through Orkes Cloud, developers can focus on building mission critical applications without worrying about infrastructure maintenance to meet goals and, simply put, taking new products live faster and reducing total cost of ownership.

Try a 14-Day Free Trial of Orkes Conductor today.

eBook – Guide Spring Cloud – NPI EA (cat=Spring Cloud)
announcement - icon

Let's get started with a Microservice Architecture with Spring Cloud:

>> Join Pro and download the eBook

eBook – Mockito – NPI EA (tag = Mockito)
announcement - icon

Mocking is an essential part of unit testing, and the Mockito library makes it easy to write clean and intuitive unit tests for your Java code.

Get started with mocking and improve your application tests using our Mockito guide:

Download the eBook

eBook – Java Concurrency – NPI EA (cat=Java Concurrency)
announcement - icon

Handling concurrency in an application can be a tricky process with many potential pitfalls. A solid grasp of the fundamentals will go a long way to help minimize these issues.

Get started with understanding multi-threaded applications with our Java Concurrency guide:

>> Download the eBook

eBook – Reactive – NPI EA (cat=Reactive)
announcement - icon

Spring 5 added support for reactive programming with the Spring WebFlux module, which has been improved upon ever since. Get started with the Reactor project basics and reactive programming in Spring Boot:

>> Join Pro and download the eBook

eBook – Java Streams – NPI EA (cat=Java Streams)
announcement - icon

Since its introduction in Java 8, the Stream API has become a staple of Java development. The basic operations like iterating, filtering, mapping sequences of elements are deceptively simple to use.

But these can also be overused and fall into some common pitfalls.

To get a better understanding on how Streams work and how to combine them with other language features, check out our guide to Java Streams:

>> Join Pro and download the eBook

eBook – Jackson – NPI EA (cat=Jackson)
announcement - icon

Do JSON right with Jackson

Download the E-book

eBook – HTTP Client – NPI EA (cat=Http Client-Side)
announcement - icon

Get the most out of the Apache HTTP Client

Download the E-book

eBook – Maven – NPI EA (cat = Maven)
announcement - icon

Get Started with Apache Maven:

Download the E-book

eBook – Persistence – NPI EA (cat=Persistence)
announcement - icon

Working on getting your persistence layer right with Spring?

Explore the eBook

eBook – RwS – NPI EA (cat=Spring MVC)
announcement - icon

Building a REST API with Spring?

Download the E-book

Course – LS – NPI EA (cat=Jackson)
announcement - icon

Get started with Spring and Spring Boot, through the Learn Spring course:

>> LEARN SPRING
Course – RWSB – NPI EA (cat=REST)
announcement - icon

Explore Spring Boot 3 and Spring 6 in-depth through building a full REST API with the framework:

>> The New “REST With Spring Boot”

Course – LSS – NPI EA (cat=Spring Security)
announcement - icon

Yes, Spring Security can be complex, from the more advanced functionality within the Core to the deep OAuth support in the framework.

I built the security material as two full courses - Core and OAuth, to get practical with these more complex scenarios. We explore when and how to use each feature and code through it on the backing project.

You can explore the course here:

>> Learn Spring Security

Partner – LambdaTest – NPI EA (cat=Testing)
announcement - icon

Browser testing is essential if you have a website or web applications that users interact with. Manual testing can be very helpful to an extent, but given the multiple browsers available, not to mention versions and operating system, testing everything manually becomes time-consuming and repetitive.

To help automate this process, Selenium is a popular choice for developers, as an open-source tool with a large and active community. What's more, we can further scale our automation testing by running on theLambdaTest cloud-based testing platform.

Read more through our step-by-step tutorial on how to set up Selenium tests with Java and run them on LambdaTest:

>> Automated Browser Testing With Selenium

Partner – Orkes – NPI EA (cat=Java)
announcement - icon

Modern software architecture is often broken. Slow delivery leads to missed opportunities, innovation is stalled due to architectural complexities, and engineering resources are exceedingly expensive.

Orkes is the leading workflow orchestration platform built to enable teams to transform the way they develop, connect, and deploy applications, microservices, AI agents, and more.

With Orkes Conductor managed through Orkes Cloud, developers can focus on building mission critical applications without worrying about infrastructure maintenance to meet goals and, simply put, taking new products live faster and reducing total cost of ownership.

Try a 14-Day Free Trial of Orkes Conductor today.

Course – LSD – NPI EA (tag=Spring Data JPA)
announcement - icon

Spring Data JPA is a great way to handle the complexity of JPA with the powerful simplicity of Spring Boot.

Get started with Spring Data JPA through the guided reference course:

>> CHECK OUT THE COURSE

Partner – Moderne – NPI EA (cat=Spring Boot)
announcement - icon

Refactor Java code safely — and automatically — with OpenRewrite.

Refactoring big codebases by hand is slow, risky, and easy to put off. That’s where OpenRewrite comes in. The open-source framework for large-scale, automated code transformations helps teams modernize safely and consistently.

Each month, the creators and maintainers of OpenRewrite at Moderne run live, hands-on training sessions — one for newcomers and one for experienced users. You’ll see how recipes work, how to apply them across projects, and how to modernize code with confidence.

Join the next session, bring your questions, and learn how to automate the kind of work that usually eats your sprint time.

eBook – Guide Spring Cloud – NPI (cat=Cloud/Spring Cloud)
announcement - icon

Let's get started with a Microservice Architecture with Spring Cloud:

>> Join Pro and download the eBook

1. Overview

Netflix ArchaiusĀ is a powerful configuration management library.

Simply put, it’s a framework that can be used to gather configuration properties from many different sources, offering fast, thread-safe access to them.

On top of this, the library allows properties to change dynamically at runtime, making it possible for the system to get these variations without having to restart the application.

In this introductory tutorial, we’ll set up a simple Spring Cloud Archaius configuration, we’ll explain what’s happening under the hood, and finally, we’ll see how Spring allows extending the basic setup.

2. Netflix Archaius Features

As we know, Spring Boot already provides instruments to manage externalized configurations, so why bother setting up a different mechanism?

Well, Archaius offers some handy and interesting features that aren’t contemplated by any other configuration framework. Some of its key points are:

  • Dynamic and Typed properties
  • A Callback mechanism that gets invoked on property mutations
  • Ready for use implementations of dynamic configuration sources such as URLs, JDBC and Amazon DynamoDB
  • A JMX MBean that can be accessed by Spring Boot Actuator or JConsoleĀ to inspect and manipulate the properties
  • Dynamic properties validation

These perks can be beneficial in many scenarios.

Therefore, Spring Cloud has worked on a library that allows to easily configure a ‘Spring Environment Bridge’ so that Archaius can read properties from the Spring Environment.

3. Dependencies

Let’s add theĀ spring-cloud-starter-netflix-archaiusĀ to our application, it’ll add all the necessary dependencies to our project.

Optionally, we can also addĀ spring-cloud-netflixĀ to ourĀ dependencyManagementĀ section and rely on its specification of the versions of the artifacts:

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

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-netflix</artifactId>
            <version>2.0.1.RELEASE</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

Note: we can check Maven Central to verify we’re using the latest version of the starter library.

4. Usage

Once we add the required dependency, we’ll be able to access the properties managed by the framework:

DynamicStringProperty dynamicProperty 
  = DynamicPropertyFactory.getInstance()
  .getStringProperty("baeldung.archaius.property", "default value");

String propertyCurrentValue = dynamicProperty.get();

Let’s work on a short example to see how this is available just out-of-the-box.

4.1. Quick Example

By default, it manages dynamically all the properties defined in a file named config.properties in the application’s classpath.

So let’s add it to our resources folder with some arbitrary properties:

#config.properties
baeldung.archaius.properties.one=one FROM:config.properties

Now we’ll need a way to check the properties’ values at any specific moment. In this case, we’ll create a RestController that retrieves the values as a JSON response:

@RestController
public class ConfigPropertiesController {
	
    private DynamicStringProperty propertyOneWithDynamic
      = DynamicPropertyFactory.getInstance()
      .getStringProperty("baeldung.archaius.properties.one", "not found!");
	
    @GetMapping("/property-from-dynamic-management")
    public String getPropertyValue() {
	return propertyOneWithDynamic.getName() + ": " + propertyOneWithDynamic.get();
    }
}

Let’s try it out. We can send a request to this endpoint, and the service will retrieve the values stored in config.propertiesĀ as expected.

No big deal so far, right? Ok, let’s go on and change the values of the property in the classpath file, without restarting the service. As a result, after a minute or so, a call to the endpoint should retrieve the new values. Pretty cool, isn’t it?

Next, we’ll try to understand what’s going on under the hood.

5. How Does It Work?

First of all, let’s attempt to comprehend the big picture.

Archaius is an extension of the Apache’s Commons Configuration library, adding some nice features like a polling framework for dynamic sources, with high throughput and thread-safe implementation.

TheĀ spring-cloud-netflix-archaiusĀ library comes then into play, merging all theĀ different property sources, andĀ auto-configuring the Archaius tools with these sources.

5.1. The Netflix Archaius Library

It operates defining a Composite Configuration, a collection of various configurations obtained from different sources.

Moreover, some of those Configuration Sources might support being polled at runtime for changes. Archaius provides interfaces and some pre-defined implementations to configure these types of sources.

The collection of sources is hierarchized so that if a property is present in multiple configurations, the final value will be the one in the topmost slot.

Finally, aĀ ConfigurationManager handles the system-wide Configuration and deployment context. It can install the final Composite Configuration, or retrieve the installed one for modification.

5.2. Spring Cloud Support

The main task of theĀ Spring Cloud Archaius library is to merge all the different configuration sources as aĀ ConcurrentCompositeConfigurationĀ and install it using theĀ ConfigurationManager.

The order of precedence in which the library defines the sources is:

  1. Any Apache Common Configuration AbstractConfiguration bean defined in the context
  2. All the sources defined in the AutowiredĀ Spring ConfigurableEnvironment
  3. The default Archaius sources, which we saw in the example above
  4. Apache’s SystemConfiguration and EnvironmentConfigurationĀ sources

Another useful feature this Spring Cloud library provides is the definition of an Actuator EndpointĀ to monitor and interact with the properties. Its usage is out of the scope of this tutorial.

6. Adapting and Extending the Archaius Configuration

Now that we have a better understanding of how Archaius works, we are in good shape to analyze how to adapt the configuration to our application, or how to extend the functionality using our configuration sources.

6.1. Archaius Supported Configuration Properties

If we want Archaius to take into account other configuration files similar to the config.propertiesĀ one, we can define theĀ archaius.configurationSource.additionalUrls system property.

The value is parsed to a list of URLs separated by a comma, so, for example, we can add this system property when we launch the application:

-Darchaius.configurationSource.additionalUrls=
  "classpath:other-dir/extra.properties,
  file:///home/user/other-extra.properties"

Archaius will read the config.properties file first, and then the other ones, in the specified order. Because of this, the properties defined in the latter files will have priority over the prior ones.

There are a couple of other system properties we can use to configure various aspects of the Archaius default configuration:

  • archaius.configurationSource.defaultFileName: the default configuration file name in the classpath
  • archaius.fixedDelayPollingScheduler.initialDelayMills: initial delay before reading the configuration source
  • archaius.fixedDelayPollingScheduler.delayMills: delay between two reads of the source; the default value is 1 minute

6.2. Adding Additional Configuration Sources with Spring

How could we add a different Configuration Source to be managed by the described framework? And how could we manage dynamic properties with higher precedence than the ones defined in the Spring Environment?

Reviewing what we mentioned in section 4.2, we can realize that the highest configurations in the Composite Configuration defined by Spring are theĀ AbstractConfiguration beans defined in the context.

Thus, all we need to do is add an implementationĀ of this Apache’s abstract class to our Spring Context using some of the functionality provided by Archaius, and the Spring’s autoconfiguration will spontaneously add it to the managed configuration properties.

To keep things simple, we’ll see an example where we configure a properties file similar to the default config.properties but with the difference of having a higher precedence than the rest of Spring environment and application properties:

@Bean
public AbstractConfiguration addApplicationPropertiesSource() {
    URL configPropertyURL = (new ClassPathResource("other-config.properties")).getURL();
    PolledConfigurationSource source = new URLConfigurationSource(configPropertyURL);
    return new DynamicConfiguration(source, new FixedDelayPollingScheduler());
}

Lucky for us, it contemplates several configuration sources that we can set up with almost no effort. Their configuration is out of the scope of this introductory tutorial.

7. Conclusion

To sum up, we’ve learned about Archaius and some of the cool features it offers to take advantage of configuration management.

Also, we saw how the Spring Cloud autoconfiguration library comes into play allowing us to use this library’s API conveniently.

The code backing this article is available on GitHub. Once you're logged in as a Baeldung Pro Member, start learning and coding on the project.
Baeldung Pro – NPI EA (cat = Baeldung)
announcement - icon

Baeldung Pro comes with both absolutely No-Ads as well as finally with Dark Mode, for a clean learning experience:

>> Explore a clean Baeldung

Once the early-adopter seats are all used, the price will go up and stay at $33/year.

Partner – Orkes – NPI EA (cat = Spring)
announcement - icon

Modern software architecture is often broken. Slow delivery leads to missed opportunities, innovation is stalled due to architectural complexities, and engineering resources are exceedingly expensive.

Orkes is the leading workflow orchestration platform built to enable teams to transform the way they develop, connect, and deploy applications, microservices, AI agents, and more.

With Orkes Conductor managed through Orkes Cloud, developers can focus on building mission critical applications without worrying about infrastructure maintenance to meet goals and, simply put, taking new products live faster and reducing total cost of ownership.

Try a 14-Day Free Trial of Orkes Conductor today.

Partner – Orkes – NPI EA (tag = Microservices)
announcement - icon

Modern software architecture is often broken. Slow delivery leads to missed opportunities, innovation is stalled due to architectural complexities, and engineering resources are exceedingly expensive.

Orkes is the leading workflow orchestration platform built to enable teams to transform the way they develop, connect, and deploy applications, microservices, AI agents, and more.

With Orkes Conductor managed through Orkes Cloud, developers can focus on building mission critical applications without worrying about infrastructure maintenance to meet goals and, simply put, taking new products live faster and reducing total cost of ownership.

Try a 14-Day Free Trial of Orkes Conductor today.

eBook – HTTP Client – NPI EA (cat=HTTP Client-Side)
announcement - icon

The Apache HTTP Client is a very robust library, suitable for both simple and advanced use cases when testing HTTP endpoints. Check out our guide covering basic request and response handling, as well as security, cookies, timeouts, and more:

>> Download the eBook

eBook – Java Concurrency – NPI EA (cat=Java Concurrency)
announcement - icon

Handling concurrency in an application can be a tricky process with many potential pitfalls. A solid grasp of the fundamentals will go a long way to help minimize these issues.

Get started with understanding multi-threaded applications with our Java Concurrency guide:

>> Download the eBook

eBook – Java Streams – NPI EA (cat=Java Streams)
announcement - icon

Since its introduction in Java 8, the Stream API has become a staple of Java development. The basic operations like iterating, filtering, mapping sequences of elements are deceptively simple to use.

But these can also be overused and fall into some common pitfalls.

To get a better understanding on how Streams work and how to combine them with other language features, check out our guide to Java Streams:

>> Join Pro and download the eBook

eBook – Persistence – NPI EA (cat=Persistence)
announcement - icon

Working on getting your persistence layer right with Spring?

Explore the eBook

Course – LS – NPI EA (cat=REST)

announcement - icon

Get started with Spring Boot and with core Spring, through the Learn Spring course:

>> CHECK OUT THE COURSE

Partner – Moderne – NPI EA (tag=Refactoring)
announcement - icon

Modern Java teams move fast — but codebases don’t always keep up. Frameworks change, dependencies drift, and tech debt builds until it starts to drag on delivery. OpenRewrite was built to fix that: an open-source refactoring engine that automates repetitive code changes while keeping developer intent intact.

The monthly training series, led by the creators and maintainers of OpenRewrite at Moderne, walks through real-world migrations and modernization patterns. Whether you’re new to recipes or ready to write your own, you’ll learn practical ways to refactor safely and at scale.

If you’ve ever wished refactoring felt as natural — and as fast — as writing code, this is a good place to start.

eBook Jackson – NPI EA – 3 (cat = Jackson)
eBook – eBook Guide Spring Cloud – NPI (cat=Cloud/Spring Cloud)