简体   繁体   中英

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

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?

The problem is that .getCanonicalPath() open the pointed file and not the symblink. If someone replace the real file with another one PropertiecConfiguration is still pointing to an not existing file, so the reload doens't work

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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