繁体   English   中英

PropertiesConfiguration 不会使用符号链接重新加载

[英]PropertiesConfiguration doesn't reload with Symbolic link

考虑到“文件”是指向真实文件的符号链接的情况

file -> real_file

如果我配置PropertiesConfiguration (来自 Apache Commons Config)来打开符号链接,如果我更新真实文件,它不会重新加载它

String filePath = new File(path).getCanonicalPath();
PropertiesConfiguration configuration = new PropertiesConfiguration(new File(filePath));
configuration.setReloadingStrategy(new FileChangedReloadingStrategy());

当然,在这种情况下,符号链接的更新日期是不变的,不像真实的。

有没有办法强制PropertiesConfiguration遵循符号链接并识别真实文件上的更改?

问题是.getCanonicalPath()打开指向的文件而不是符号链接。 如果有人用另一个替换真实文件, PropertiecConfiguration仍然指向一个不存在的文件,所以重新加载不起作用

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM