Skip to content

"file:." cannot be resolved to java.nio.file.Path (and plain "." value resolves to classpath root) #33124

Closed
@ewoerner

Description

@ewoerner

Given the following stripped-down demo application:

@SpringBootApplication
public class InjectedPathDemoApplication implements ApplicationRunner {
	@Value("${dir}")
	private Path dir;

	public static void main(String[] args) {
		SpringApplication.run(InjectedPathDemoApplication.class, args);
	}

	@Override
	public void run(ApplicationArguments args) throws Exception {
		System.out.println(dir);
	}
}

When run using a JDK in Windows:

$ java -jar demo.jar --dir=..
..
$ java -jar demo.jar --dir=./test
test
$ java -jar demo.jar --dir=.
C:\■■■■■■■■\injected-path-demo\bin\main

When run as native binary compiled with GraalVM:

$ ./demo-native --dir=..
..
$ ./demo-native --dir=./test
test
$ ./demo-native --dir=.
Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'injectedPathDemoApplication': Unsatisfied dependency expressed through field 'dir': Failed to convert value of type 'java.lang.String' to required type 'java.nio.file.Path'; Could not retrieve file for class path resource []: class path resource [] cannot be resolved to absolute file path because it does not reside in the file system: resource:/
Application run failed
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'injectedPathDemoApplication': Unsatisfied dependency expressed through field 'dir': Failed to convert value of type 'java.lang.String' to required type 'java.nio.file.Path'; Could not retrieve file for class path resource []: class path resource [] cannot be resolved to absolute file path because it does not reside in the file system: resource:/
        at org.springframework.beans.factory.aot.AutowiredFieldValueResolver.resolveValue(AutowiredFieldValueResolver.java:194)
        at org.springframework.beans.factory.aot.AutowiredFieldValueResolver.resolveAndSet(AutowiredFieldValueResolver.java:167)
        at com.example.demo.InjectedPathDemoApplication__Autowiring.apply(InjectedPathDemoApplication__Autowiring.java:17)
        at org.springframework.beans.factory.support.InstanceSupplier$1.get(InstanceSupplier.java:83)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.obtainInstanceFromSupplier(DefaultListableBeanFactory.java:949)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.obtainFromSupplier(AbstractAutowireCapableBeanFactory.java:1219)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1162)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:562)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:522)
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:337)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:335)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:975)
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:962)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:624)
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754)
        at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:456)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:335)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1363)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1352)
        at com.example.demo.InjectedPathDemoApplication.main(InjectedPathDemoApplication.java:17)
Caused by: org.springframework.beans.TypeMismatchException: Failed to convert value of type 'java.lang.String' to required type 'java.nio.file.Path'; Could not retrieve file for class path resource []: class path resource [] cannot be resolved to absolute file path because it does not reside in the file system: resource:/
        at org.springframework.beans.TypeConverterSupport.convertIfNecessary(TypeConverterSupport.java:87)
        at org.springframework.beans.TypeConverterSupport.convertIfNecessary(TypeConverterSupport.java:71)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1381)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1353)
        at org.springframework.beans.factory.aot.AutowiredFieldValueResolver.resolveValue(AutowiredFieldValueResolver.java:188)
        ... 21 more
Caused by: java.lang.IllegalArgumentException: Could not retrieve file for class path resource []: class path resource [] cannot be resolved to absolute file path because it does not reside in the file system: resource:/
        at org.springframework.beans.propertyeditors.PathEditor.setAsText(PathEditor.java:115)
        at org.springframework.beans.TypeConverterDelegate.doConvertTextValue(TypeConverterDelegate.java:439)
        at org.springframework.beans.TypeConverterDelegate.doConvertValue(TypeConverterDelegate.java:412)
        at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:161)
        at org.springframework.beans.TypeConverterSupport.convertIfNecessary(TypeConverterSupport.java:80)
        ... 25 more

Expected result for the third call: returns either "." or "", and does not throw an error on native

Activity

sbrannen

sbrannen commented on Jun 30, 2024

@sbrannen
Member

Hi @ewoerner,

Congratulations on opening your first issue for the Spring Framework! 👍

What happens if you introduce the file: prefix as follows?

@Value("file:${dir}")
changed the title [-]Strange value injection of "." into path[/-] [+]Strange `@Value` injection of "." into `Path` in native image[/+] on Jun 30, 2024
ewoerner

ewoerner commented on Jun 30, 2024

@ewoerner
Author

@sbrannen that causes injection to fail with any value, with the following stacktrace:

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'injectedPathDemoApplication': Unsatisfied dependency expressed through field 'dir': Failed to convert value of type 'java.lang.String' to required type 'java.nio.file.Path'; URI is not hierarchical
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:787) ~[spring-beans-6.1.10.jar:6.1.10]
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:767) ~[spring-beans-6.1.10.jar:6.1.10]
	at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:145) ~[spring-beans-6.1.10.jar:6.1.10]
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:508) ~[spring-beans-6.1.10.jar:6.1.10]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1421) ~[spring-beans-6.1.10.jar:6.1.10]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:599) ~[spring-beans-6.1.10.jar:6.1.10]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:522) ~[spring-beans-6.1.10.jar:6.1.10]
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:337) ~[spring-beans-6.1.10.jar:6.1.10]
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-6.1.10.jar:6.1.10]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:335) ~[spring-beans-6.1.10.jar:6.1.10]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) ~[spring-beans-6.1.10.jar:6.1.10]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:975) ~[spring-beans-6.1.10.jar:6.1.10]
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:962) ~[spring-context-6.1.10.jar:6.1.10]
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:624) ~[spring-context-6.1.10.jar:6.1.10]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754) ~[spring-boot-3.3.1.jar:3.3.1]
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:456) ~[spring-boot-3.3.1.jar:3.3.1]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:335) ~[spring-boot-3.3.1.jar:3.3.1]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1363) ~[spring-boot-3.3.1.jar:3.3.1]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1352) ~[spring-boot-3.3.1.jar:3.3.1]
	at com.example.demo.InjectedPathDemoApplication.main(InjectedPathDemoApplication.java:17) ~[main/:na]
Caused by: org.springframework.beans.TypeMismatchException: Failed to convert value of type 'java.lang.String' to required type 'java.nio.file.Path'; URI is not hierarchical
	at org.springframework.beans.TypeConverterSupport.convertIfNecessary(TypeConverterSupport.java:87) ~[spring-beans-6.1.10.jar:6.1.10]
	at org.springframework.beans.TypeConverterSupport.convertIfNecessary(TypeConverterSupport.java:71) ~[spring-beans-6.1.10.jar:6.1.10]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1381) ~[spring-beans-6.1.10.jar:6.1.10]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1353) ~[spring-beans-6.1.10.jar:6.1.10]
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:784) ~[spring-beans-6.1.10.jar:6.1.10]
	... 19 common frames omitted
Caused by: java.lang.IllegalArgumentException: URI is not hierarchical
	at java.base/sun.nio.fs.WindowsUriSupport.fromUri(WindowsUriSupport.java:123) ~[na:na]
	at java.base/sun.nio.fs.WindowsFileSystemProvider.getPath(WindowsFileSystemProvider.java:98) ~[na:na]
	at java.base/java.nio.file.Path.of(Path.java:203) ~[na:na]
	at java.base/java.nio.file.Paths.get(Paths.java:98) ~[na:na]
	at org.springframework.beans.propertyeditors.PathEditor.setAsText(PathEditor.java:86) ~[spring-beans-6.1.10.jar:6.1.10]
	at org.springframework.beans.TypeConverterDelegate.doConvertTextValue(TypeConverterDelegate.java:439) ~[spring-beans-6.1.10.jar:6.1.10]
	at org.springframework.beans.TypeConverterDelegate.doConvertValue(TypeConverterDelegate.java:412) ~[spring-beans-6.1.10.jar:6.1.10]
	at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:161) ~[spring-beans-6.1.10.jar:6.1.10]
	at org.springframework.beans.TypeConverterSupport.convertIfNecessary(TypeConverterSupport.java:80) ~[spring-beans-6.1.10.jar:6.1.10]
	... 23 common frames omitted


sbrannen

sbrannen commented on Jun 30, 2024

@sbrannen
Member

How about @Value("file://${dir}")?

ewoerner

ewoerner commented on Jun 30, 2024

@ewoerner
Author

That also throws, but with a different root cause:

[...]
Caused by: java.lang.IllegalArgumentException: URI path component is empty
	at java.base/sun.nio.fs.WindowsUriSupport.fromUri(WindowsUriSupport.java:133) ~[na:na]
	at java.base/sun.nio.fs.WindowsFileSystemProvider.getPath(WindowsFileSystemProvider.java:98) ~[na:na]
	at java.base/java.nio.file.Path.of(Path.java:203) ~[na:na]
	at java.base/java.nio.file.Paths.get(Paths.java:98) ~[na:na]
	at org.springframework.beans.propertyeditors.PathEditor.setAsText(PathEditor.java:86) ~[spring-beans-6.1.10.jar:6.1.10]
	at org.springframework.beans.TypeConverterDelegate.doConvertTextValue(TypeConverterDelegate.java:439) ~[spring-beans-6.1.10.jar:6.1.10]
	at org.springframework.beans.TypeConverterDelegate.doConvertValue(TypeConverterDelegate.java:412) ~[spring-beans-6.1.10.jar:6.1.10]
	at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:161) ~[spring-beans-6.1.10.jar:6.1.10]
	at org.springframework.beans.TypeConverterSupport.convertIfNecessary(TypeConverterSupport.java:80) ~[spring-beans-6.1.10.jar:6.1.10]
	... 23 common frames omitted
sbrannen

sbrannen commented on Jun 30, 2024

@sbrannen
Member

Thanks for trying out both of those variants and providing feedback!

I unfortunately don't work on a Windows machine, so I don't have an easy way to test this. Though, perhaps one of my colleagues can test this on Windows.

In the interim, please let us know which versions of the following you are using.

  • MS Windows
  • JDK
  • GraalVM

From the stack trace, I can deduce that you're using Spring Boot 3.3.1 with Spring Framework 6.1.10.

snicoll

snicoll commented on Jul 1, 2024

@snicoll
Member

There's not much Spring is doing around that call stack. Since you can easily reproduce, it would be helpful to see if the raw Java API usage throws that exception as well. Can you please replace the @Value injection by the following in your run method?

Paths.get(URI.create("."));

If this fails as well, we know we can close this in favour of a report in GraalVM itself.

added
in: coreIssues in core modules (aop, beans, core, context, expression)
on Jul 1, 2024
ewoerner

ewoerner commented on Jul 2, 2024

@ewoerner
Author

Version info, as requested:
Windows 11
OpenJDK Runtime Environment GraalVM CE 17.0.9+9.1 (build 17.0.9+9-jvmci-23.0-b22)
OpenJDK Runtime Environment Temurin-21.0.2+13 (build 21.0.2+13-LTS)

Turns out I did not test properly (I ran it from Eclipse), the exception is also reproducible without GraalVM when built as a JAR file:

$ java -jar .\injected-path-demo-1-0.0.1-SNAPSHOT.jar --dir=.
[...]
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'injectedPathDemoApplication': Unsatisfied dependency expressed through field 'dir': Failed to convert value of type 'java.lang.String' to required type 'java.nio.file.Path'; Could not retrieve file for class path resource []: class path resource [] cannot be resolved to absolute file path because it does not reside in the file system: jar:nested:/C:/■■■■■■■■/injected-path-demo-1/build/libs/injected-path-demo-1-0.0.1-SNAPSHOT.jar/!BOOT-INF/classes/!/
        at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:787) ~[spring-beans-6.1.10.jar!/:6.1.10]
        at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:767) ~[spring-beans-6.1.10.jar!/:6.1.10]
        at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:145) ~[spring-beans-6.1.10.jar!/:6.1.10]
        at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:508) ~[spring-beans-6.1.10.jar!/:6.1.10]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1421) ~[spring-beans-6.1.10.jar!/:6.1.10]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:599) ~[spring-beans-6.1.10.jar!/:6.1.10]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:522) ~[spring-beans-6.1.10.jar!/:6.1.10]
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:337) ~[spring-beans-6.1.10.jar!/:6.1.10]
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-6.1.10.jar!/:6.1.10]
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:335) ~[spring-beans-6.1.10.jar!/:6.1.10]
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) ~[spring-beans-6.1.10.jar!/:6.1.10]
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:975) ~[spring-beans-6.1.10.jar!/:6.1.10]
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:962) ~[spring-context-6.1.10.jar!/:6.1.10]
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:624) ~[spring-context-6.1.10.jar!/:6.1.10]
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754) ~[spring-boot-3.3.1.jar!/:3.3.1]
        at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:456) ~[spring-boot-3.3.1.jar!/:3.3.1]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:335) ~[spring-boot-3.3.1.jar!/:3.3.1]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1363) ~[spring-boot-3.3.1.jar!/:3.3.1]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1352) ~[spring-boot-3.3.1.jar!/:3.3.1]
        at com.example.demo.InjectedPathDemoApplication.main(InjectedPathDemoApplication.java:17) ~[!/:0.0.1-SNAPSHOT]
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[na:na]
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
        at java.base/java.lang.reflect.Method.invoke(Method.java:568) ~[na:na]
        at org.springframework.boot.loader.launch.Launcher.launch(Launcher.java:91) ~[injected-path-demo-1-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
        at org.springframework.boot.loader.launch.Launcher.launch(Launcher.java:53) ~[injected-path-demo-1-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
        at org.springframework.boot.loader.launch.JarLauncher.main(JarLauncher.java:58) ~[injected-path-demo-1-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
Caused by: org.springframework.beans.TypeMismatchException: Failed to convert value of type 'java.lang.String' to required type 'java.nio.file.Path'; Could not retrieve file for class path resource []: class path resource [] cannot be resolved to absolute file path because it does not reside in the file system: jar:nested:/C:/■■■■■■■■/injected-path-demo-1/build/libs/injected-path-demo-1-0.0.1-SNAPSHOT.jar/!BOOT-INF/classes/!/
        at org.springframework.beans.TypeConverterSupport.convertIfNecessary(TypeConverterSupport.java:87) ~[spring-beans-6.1.10.jar!/:6.1.10]
        at org.springframework.beans.TypeConverterSupport.convertIfNecessary(TypeConverterSupport.java:71) ~[spring-beans-6.1.10.jar!/:6.1.10]
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1381) ~[spring-beans-6.1.10.jar!/:6.1.10]
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1353) ~[spring-beans-6.1.10.jar!/:6.1.10]
        at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:784) ~[spring-beans-6.1.10.jar!/:6.1.10]
        ... 26 common frames omitted
Caused by: java.lang.IllegalArgumentException: Could not retrieve file for class path resource []: class path resource [] cannot be resolved to absolute file path because it does not reside in the file system: jar:nested:/C:/■■■■■■■■/injected-path-demo-1/build/libs/injected-path-demo-1-0.0.1-SNAPSHOT.jar/!BOOT-INF/classes/!/
        at org.springframework.beans.propertyeditors.PathEditor.setAsText(PathEditor.java:115) ~[spring-beans-6.1.10.jar!/:6.1.10]
        at org.springframework.beans.TypeConverterDelegate.doConvertTextValue(TypeConverterDelegate.java:439) ~[spring-beans-6.1.10.jar!/:6.1.10]
        at org.springframework.beans.TypeConverterDelegate.doConvertValue(TypeConverterDelegate.java:412) ~[spring-beans-6.1.10.jar!/:6.1.10]
        at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:161) ~[spring-beans-6.1.10.jar!/:6.1.10]
        at org.springframework.beans.TypeConverterSupport.convertIfNecessary(TypeConverterSupport.java:80) ~[spring-beans-6.1.10.jar!/:6.1.10]
        ... 30 common frames omitted

So the chain seems to be as follows:

  • Since the value does not start with a "/" and has no scheme, the PathEditor directly delegates its work to the ResourceEditor
  • The ResourceEditor resolves the resource to a DefaultResourceLoader.ClassPathContextResource
  • The PathEditor checks whether the resource exists; this is true for "."
  • Since the resource exists, the PathEditor calls AbstractFileResolvingResource.getFile() which only supports "vfs" and "file" protocol. However, the protocol is "jar" (with JAR) or "resource" (with GraalVM native binary).

The error also happens with any other value that resolves to an existing resource, so --dir=application.properties also throws an Exception.

10 remaining items

self-assigned this
on Jul 3, 2024
added this to the 6.1.11 milestone on Jul 3, 2024
jhoeller

jhoeller commented on Jul 3, 2024

@jhoeller
Contributor

We're catching the IllegalArgumentException for non-hierarchical URIs now, letting the regular resource resolution apply which is capable of resolving file:. already. Also, we're providing a more meaningful exception for our own file-resolution IllegalArgumentException now.

added a commit that references this issue on Jul 3, 2024
daea3f0
added 2 commits that reference this issue on Jul 3, 2024
069d081
2302b30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)status: backportedAn issue that has been backported to maintenance branchestype: bugA general bug

Type

No type

Projects

No projects

Relationships

None yet

    Development

    No branches or pull requests

      Participants

      @sbrannen@snicoll@jhoeller@ewoerner@spring-projects-issues

      Issue actions

        "file:." cannot be resolved to `java.nio.file.Path` (and plain "." value resolves to classpath root) · Issue #33124 · spring-projects/spring-framework