We are injecting a `java.nio.Path` object into some bean as a class field, say `rootPath`. The injected Path object is then used as follows
java.nio.files.Files.createDirectories(rootPath)
|
This leads to a `java.nio.file.ProviderMismatchException` when the producer of the path object additionally declares `@ApplicationScoped`. Further debugging shows that in this case the path instance is a WELD proxy: `Comparable$Iterable$Path$Watchable$538699755$Proxy$_$$_WeldClientProxy`. However, the code without declaring `@ApplicationScoped` for the producer. In this case the path instance is a `sun.nio.fs.UnixPath` and the statement above does not throw the exception. This seems to be related to this question on Stackoverflow. Seems that the proxy somehow interferes with the provider. |