I have this values in application.yaml
import-charge-fields:
4: billDate
1001: validUntil
7: totalAmount
24: purpose
And in service I try inject it:
@Value("${import-charge-fields}")
private Map<String, String> fields;
But I get exception:
Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'import-charge-fields' in value "${import-charge-fields}"
I try this:
charge:
hz: 123
fields:
4: billDate
1001: validUntil
7: totalAmount
24: purpose
and
@Getter
@Setter
@Component
@ConfigurationProperties(prefix = "charge")
public class ChargeFields {
private String hz;
private Map<String, String> fields;
}
and
@Value("${charge.hz}")
private String hz;
@Value("${charge.fields}")
private Map<String, String> fields;
and it not work