Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Full path as a bean property in Spring

Tags:

java

spring

Say, I have the following bean in Spring context:

<bean class="some.class.BlabBlahBlah">
    <property name="location" value="classpath:somefile.xml"/>
</bean> 

Currently somefile.xml is placed in the src/main/java, but I'd like to place it somewhere in the file system. Is there a way to do that? I tried to set full path instead of this classpath: but it didn't work. Thanks in advance.

like image 619
John Doe Avatar asked Feb 20 '23 01:02

John Doe


1 Answers

By reference (Table 4.1), you should probably use a file system resource path:

<property name="location" value="file:/path/to/file.xml" />
like image 168
nobeh Avatar answered Feb 26 '23 12:02

nobeh