Spring boot version: 2.4.3 Sample code: https://github.com/rsenden/spring-boot-converter-issue

The sample code in the repository listed above runs fine with ./gradlew bootRun, but fails when running java -jar build/libs/demo-0.0.1-SNAPSHOT.jar.

Basically, binding a property to a java.io.File field fails if the property contains a non-existing Windows path, for example C:\Temp\SomeNonExistingFile.txt. This is caused by the org.springframework.boot.convert.StringToFileConverter.convert(String) method calling resource.exists(), which fails when the resource points to a fully qualified Windows-style path when running with org.springframework.boot.loader.LaunchedURLClassLoader.

Comment From: snicoll

Thanks for the sample, I've reproduced the problem. A related fix was applied in the Spring Framework version that ships with Spring Boot 2.4.4. I've upgraded your sample to it and I can no longer reproduce the problem.