Skip to content

Root path resolution for java.nio.Path properties does not work on Linux anymore #26702

Closed
@plc010

Description

@plc010

Under Spring Boot 2.4.4 having a configuration class with a java.nio.Path field does not map correctly for a root filesystem on Linux if the spring-boot-web-starter is included.

Example application.properties value:
my-config.workingPath=/my-working-path

When the above is run on linux with the web starter included, the path is set under the tomcat temp directory, or under the exploded WAR file directory if running on a different application server.

If the path is set to a value such as: c:\temp\my-working-path on a Windows machine, there is no issue with or without the web starter dependency.

Creating a ConfigurationPropertiesBinding converter seems to be picked up when running on Windows, but ignored on Linux.

Changing the properties class field from java.nio.Path to String and implementing a custom get method that returns Paths.get(s) works fine on windows and linxu both with and without the web starter included in the project.

Issue does not seem to exist prior to Spring Boot 2.4.4.

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)type: regressionA bug that is also a regression

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions