- 定义ContentTypeMap.properties文件
- 定义初始化
12345678910private static Properties contentTypeMap;static {Resource resource = new ClassPathResource("/" + CONTENT_TYPE_MAP_FILE);try {contentTypeMap = PropertiesLoaderUtils.loadProperties(resource);} catch (IOException e) {e.printStackTrace();}} - 使用
1String contentType = contentTypeMap.getProperty(fileExt);