问题
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?
回答1:
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
来源:https://stackoverflow.com/questions/13680584/spring-factory-method-for-path