Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spring - factory method for Path

I am trying to generate a bean that would represent java.nio.file.Path using a static method Paths.get(String path). my current Spring setup looks as follows:

<bean id="myPath" class="java.nio.file.Paths" factory-method="get">
    <constructor-arg value="c:\\tmp\\" />
</bean>

but it comes back with an excpetion No matching factory method found: factory method 'get'. Any ideas why that is the case?

like image 378
Bober02 Avatar asked Dec 03 '12 09:12

Bober02


1 Answers

java.nio.file.Paths.get expects URI. Besides, this is xml not java don't use \\

Try as

file:/C:/tmp/

If you have problems with URI syntax visit http://en.wikipedia.org/wiki/File_url

like image 110
Evgeniy Dorofeev Avatar answered Nov 09 '22 18:11

Evgeniy Dorofeev