简体   繁体   中英

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM