This is the code to get the present working directory of a java application at runtime.
String currentWorkingDirectory = System.getProperty("user.dir")+System.getProperty("file.separator");
Is there any way by which this can be configured using the spring-context xml.
For ex:
<bean id="csvReportGenerator" class="some.path.CSVReportGenerator">
<constructor-arg name="outputFileName" value="${currentWorkingDirectory}/${reportOutputFileGeneric}"/>
</bean>
Yes, you can do it using Spring expressions. See section 6.4.1 of this article
<property name="userDir" value="#{ systemProperties['user.dir'] }"/>
<property name="fileSep" value="#{ systemProperties['file.separator'] }"/>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With