I would like to read an array of proprieties from application.properties in spring with a wildcard.
For example I have this properties:
file.processing.xpath.query.1=query1
file.processing.xpath.query.2=query2
and then I would like to get the properties in an array or in a list like this
@Value("${file.processing.xpath.query.*}")
private String[] xpathQuery;
is there a way to do this?
when I try to do it like this I receive an exception
Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'file.processing.xpath.query' in string value "${file.processing.xpath.query.*}"
You have to define your properties like this:
file.processing.xpath.query=query1,query2,query3
And then use:
@Value("${file.processing.xpath.query}")
private String[] xpathQuery;
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.