views:

453

answers:

1

Hi,

I want to specify a file system path as part of a Spring bean configuration. I know that I can set a path such as:

<bean id="myBean" class="com.example.BeanImpl">
  <property name="path" value="/WEB-INF/jsp"/>
</bean>

An the path /WEB-INF/jsp is interpreted as being relative to the web application root. But how do I specify a path relative to file system root, e.g. /usr/bin

Cheers, Don

+1  A: 

Use the file: predicate, like so:

<property name="path" value="file:c:/somefolder/someotherfolder"/>

Now that I think about it, its also about what the bean expects that path to be. Is it using the path to throw at a browser (which makes the whole file: thing relative on the client machine) or do you use it to programatically load a file which is on the server?

Rolf
I'm using the path to load a file on the server
Don
fixing my typo's Don ;-)
Rolf