Reputation: 86905
@Value("file:" + "${d:/my/dir/}")
private Resource dir;
How can I get the number of files in that resource dir? Unfortunately the Resource
interfaces does not offer any getFiles() method...
Upvotes: 0
Views: 64
Reputation: 1743
Based on this version of the Resource interface, you can call getFile
File theDir = dir.getFile();
if (theDir.isDirectory()) {
theDir.list();
}
if you combine this with the propertyplaceholderconfigurer you might get what you're lookign for:
Upvotes: 1