我有一个带有这个spring属性的服务:
@Value("#{${table.to.key.order.by: {'table': {'key' , 'order'}}}}")
private Map<String, Map.Entry<String, String>> tableToKeyOrderMap;
由于某些原因,我在启动时得到了这个错误:
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'tableService':
Unsatisfied dependency expressed through field 'tableToKeyOrderMap';
nested exception is org.springframework.beans.ConversionNotSupportedException:
Failed to convert value of type 'java.util.Collections$UnmodifiableMap' to required type 'java.util.Map';
nested exception is java.lang.IllegalStateException: Cannot convert value of type 'java.util.Collections$UnmodifiableRandomAccessList' to required type 'java.util.Map$Entry': no matching editors or conversion strategy found
提前感谢任何输入!
尝试将值从@Value("#{${table.to.key.order.by: {'table': {'key' , 'order'}}}}")
更改为@Value("#{${table.to.key.order.by: {'table': {'key' : 'order'}}}}")
{'key' , 'order'}
读作List