That is valid :
@Value("app.users-location")
String foo; // inject "/feed/*.csv"
And that is also valid (source) :
@Value("classpath*:/feed/*.csv")
Collection<Resource> resources; // inject all resources located in this classpath
But I don't know how to mix them in a single annotation : that is resolve the property and use it with a classpath*:
prefix. Maybe that is possible...
Whatever, as alternative I would inject this property app.users-location=/feed/*.csv
and I would use @PostConstruct
to get resources from that :
import org.springframework.core.io.support.*
@Value("${app.users-location}")
private String usersLocation;
private Collection<Resource> csvResources;
@PostConstruct
public void init(){
ResourcePatternResolver patternResolver = new PathMatchingResourcePatternResolver();
csvResources =
Arrays.asList(patternResolver.getResources("classpath*:/" + usersLocation));
}