这是因为
Propertiesextends
Hashtable<Object,Object>(又实现了
Map<Object,Object>)。您尝试将其输入
Map<String, String>。因此,它是不兼容的。
您需要将字符串属性一一输入到地图中。
例如:
for (final String name: properties.stringPropertyNames()) map.put(name, properties.getProperty(name));

这是因为
Propertiesextends
Hashtable<Object,Object>(又实现了
Map<Object,Object>)。您尝试将其输入
Map<String, String>。因此,它是不兼容的。
您需要将字符串属性一一输入到地图中。
例如:
for (final String name: properties.stringPropertyNames()) map.put(name, properties.getProperty(name));