My pull request #52666 was merged into Spring Boot. You can run into the same bug setting up your own project. In my Spring Boot 4.0.9 repro, I put app/ and config/ side by side, ran the program from app/, and set this one line in application.properties. Spring Boot PR #52666

spring.config.import=configtree:../config/

The directory existed and the import raised no error, but demo.banner was missing. I changed the import to an absolute path to the same directory, and the value came back. An application with a fallback value can keep running until you notice it’s doing something unexpected.

How I found it

I was reading Spring Boot’s external configuration code to see where it handles unusual paths. In a configuration tree, each file supplies a value and its path supplies the key. A file named demo.banner containing hello-configtree gives you a property named demo.banner. Nested directories become dot-separated parts of the key. Spring Boot configuration tree documentation

I noticed a filter that skipped a file if any path segment started with ... That makes sense for internal entries like Kubernetes’ ..data. What caught my eye was that the code passed the full path to the filter. What would happen if the two dots were outside the configuration directory, as in ../config/? I reduced the question to one file and two paths to the same directory.

Reproduce the configtree bug on Spring Boot 4.0.9

I ran this on macOS with JDK 21 and Spring Boot 4.0.9 from Maven Central. The program uses Spring Boot’s Config Data loading path. It doesn’t need a web server.

mkdir -p configtree-demo/app configtree-demo/config
printf '%s\n' hello-configtree > configtree-demo/config/demo.banner
cd configtree-demo/app

Create pom.xml in app/:

<project xmlns="http://maven.apache.org/POM/4.0.0">
  <modelVersion>4.0.0</modelVersion>
  <groupId>example</groupId>
  <artifactId>configtree-demo</artifactId>
  <version>1.0.0</version>
  <dependencies>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot</artifactId>
      <version>4.0.9</version>
    </dependency>
  </dependencies>
</project>

Then create Demo.java alongside it. The fallback makes it obvious when the property is missing.

import org.springframework.boot.context.config.ConfigDataEnvironmentPostProcessor;
import org.springframework.core.env.StandardEnvironment;

public class Demo {
    public static void main(String[] args) {
        var env = new StandardEnvironment();
        ConfigDataEnvironmentPostProcessor.applyTo(env);
        System.out.println("demo.banner=" + env.getProperty("demo.banner", "<missing>"));
    }
}

Run both imports from app/:

mvn -q dependency:build-classpath -Dmdep.outputFile=classpath.txt
javac -cp "$(cat classpath.txt)" Demo.java

java -Dspring.config.import=configtree:../config/ \
  -cp ".:$(cat classpath.txt)" Demo
# demo.banner=<missing>

java "-Dspring.config.import=configtree:$(cd ../config && pwd -P)/" \
  -cp ".:$(cat classpath.txt)" Demo
# demo.banner=hello-configtree

The JVM flag makes the two runs easy to compare. I also tested the application.properties version shown above and got the same result. This non-wildcard import resolves the relative path from the process’s working directory and requires a trailing slash.

Where the files went missing

ConfigTreeConfigDataResource calls Paths.get(path).toAbsolutePath(). In this case, that prepends the working directory and leaves the .. segment in place. The directory exists, so the loader goes on to create a ConfigTreePropertySource. Path handling before the fix

The old code filters the full path in the Files.find predicate before it makes the path relative to the configuration root. Every visited file has the same app/../config/ prefix. Its .. segment matches startsWith(".."), so every file is skipped. The property source exists, but its property map is empty. File discovery before the fix

What changed upstream

The merged code uses the Files.find predicate to select regular files and symbolic links and keeps following links. It then calls sourceDirectory.relativize(path) to get a path within the tree. getName(relativePath) checks for the same two-dot prefix. If a segment inside the tree matches, it returns null and the property isn’t registered. For the example above, it sees demo.banner and registers it. Merged implementation

I compiled ConfigTreePropertySource from each of the two upstream commits and swapped just that class on the same 4.0.9 classpath. The old class printed <missing> for the relative path, and the merged class printed hello-configtree. I also tested a normally named link, linked.banner, pointing to ..data/linked.banner. The merged code read the link’s value and listed only demo.banner and linked.banner, so the internal entry wasn’t registered separately.

The upstream regression test writes a file named a, reaches its directory through <name>/../<name>, and asserts that getPropertyNames() returns exactly a. Regression test

The fix was merged into 4.0.x on November 13, 2026 (China Standard Time). The PR is assigned to the 4.0.10 milestone. If you hit the issue on your current version, using an absolute import path without .. works around it.

Come talk about open source

I’d like to write up the Drools bug involving capitalized annotations next. If you’re reading source code, preparing an upstream PR, or stuck on a reproduction, come talk about it in the WeChat group. Scan the code to add me on WeChat with “进群” in your friend request, and I’ll send you an invitation.

Scan to add eatmoreduck on WeChat and request a group invitation

For more write-ups, you can also follow the 多吃鸭 WeChat public account.

QR code for the 多吃鸭 WeChat public account

eatmoreduck 多吃鸭