Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/spring-boot/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Spring boot Spring application.properties-如何设置windows文件名路径?_Spring Boot - Fatal编程技术网

Spring boot Spring application.properties-如何设置windows文件名路径?

Spring boot Spring application.properties-如何设置windows文件名路径?,spring-boot,Spring Boot,我正在尝试重构一个Spring启动应用程序,其中硬编码的CSV文件名将替换为从“application.properties”文件中提取的文件名,如 outputRoleCsv("d:\\temp\\lean-actor-role.csv",aModel.getActorRoles()); 属性文件中的属性设置为 file.name.actor.role="d:\\temp\\lean-actor-role.csv" 但是,当我用属性派生值替换硬编码文

我正在尝试重构一个Spring启动应用程序,其中硬编码的CSV文件名将替换为从“application.properties”文件中提取的文件名,如

outputRoleCsv("d:\\temp\\lean-actor-role.csv",aModel.getActorRoles());
属性文件中的属性设置为

file.name.actor.role="d:\\temp\\lean-actor-role.csv"
但是,当我用属性派生值替换硬编码文件名时,我得到一个错误

java.io.FileNotFoundException: "d:\ emp\lean-actor-role.csv" (The filename, directory name, or volume label syntax is incorrect)
at java.base/java.io.FileOutputStream.open0(Native Method)
at java.base/java.io.FileOutputStream.open(FileOutputStream.java:298)
at java.base/java.io.FileOutputStream.<init>(FileOutputStream.java:237)
at java.base/java.io.FileOutputStream.<init>(FileOutputStream.java:187)
java.io.FileNotFoundException:“d:\emp\lean actor role.csv”(文件名、目录名或卷标语法不正确)
位于java.base/java.io.FileOutputStream.open0(本机方法)
位于java.base/java.io.FileOutputStream.open(FileOutputStream.java:298)
位于java.base/java.io.FileOutputStream(FileOutputStream.java:237)
位于java.base/java.io.FileOutputStream。(FileOutputStream.java:187)
这显然与“\”字符有关,但我找不到设置application.properties值的方法


建议?

属性文件中不需要双引号。删除双引号,它就会工作

file.name.actor.role=d:\\temp\\lean-actor-role.csv

你有没有试过在删除double引号后。。。好样的!谢谢