这是在运行时获取Java应用程序的当前工作目录的代码.
String currentWorkingDirectory = System.getProperty("user.dir")+System.getProperty("file.separator");
Run Code Online (Sandbox Code Playgroud)
有没有办法使用spring-context xml配置它.
例如:
<bean id="csvReportGenerator" class="some.path.CSVReportGenerator">
<constructor-arg name="outputFileName" value="${currentWorkingDirectory}/${reportOutputFileGeneric}"/>
</bean>
Run Code Online (Sandbox Code Playgroud)