简体   繁体   English

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

[英]PropertiesConfiguration doesn't reload with Symbolic link

Considering the scenario where 'file' is a symbolic link to a real one考虑到“文件”是指向真实文件的符号链接的情况

file -> real_file

if I configure PropertiesConfiguration (from Apache Commons Config) to open the symbolic link it doens't reload it if I update the real file如果我配置PropertiesConfiguration (来自 Apache Commons Config)来打开符号链接,如果我更新真实文件,它不会重新加载它

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

Of course, in this case the update date of the symbolic link is unchanged, unlike the real one.当然,在这种情况下,符号链接的更新日期是不变的,不像真实的。

Is there a way to force PropertiesConfiguration to follow symbolic link and recognize changes on real file?有没有办法强制PropertiesConfiguration遵循符号链接并识别真实文件上的更改?

The problem is that .getCanonicalPath() open the pointed file and not the symblink.问题是.getCanonicalPath()打开指向的文件而不是符号链接。 If someone replace the real file with another one PropertiecConfiguration is still pointing to an not existing file, so the reload doens't work如果有人用另一个替换真实文件, PropertiecConfiguration仍然指向一个不存在的文件,所以重新加载不起作用

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

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