Spring - Path的工厂方法

Bob*_*r02 6 java spring factory factory-method

我正在尝试生成一个代表java.nio.file.Path使用静态方法的bean Paths.get(String path).我目前的Spring设置如下:

<bean id="myPath" class="java.nio.file.Paths" factory-method="get">
    <constructor-arg value="c:\\tmp\\" />
</bean>
Run Code Online (Sandbox Code Playgroud)

但它带来了一个令人兴奋的回归No matching factory method found: factory method 'get'.任何想法为什么会这样?

Evg*_*eev 9

java.nio.file.Paths.get需要URI.另外,这是xml不是java不要用\\

试试吧

file:/C:/tmp/
Run Code Online (Sandbox Code Playgroud)

如果您遇到URI语法问题,请访问http://en.wikipedia.org/wiki/File_url