public class OrderService { private static Logger logger = Logger.getLogger(OrderService.class); private static Properties props = null; static { props = new Properties(); try { InputStream in = OrderService.class.getClass().getResourceAsStream("/status.properties"); props.load(in); } catch (Exception e) { logger.error("状态资源文件未加载" + e.getMessage()); } } public static void main(String[] args) { Map<String, String> map = new HashMap<String, String>((Map) props); Set propertySet = map.entrySet(); for (Object o : propertySet) { Map.Entry entry = (Map.Entry) o; System.out.printf("%s = %s%n", entry.getKey(), entry.getValue()); } } }
status.base.order10 = CLOSE_REFUND status.base.order7 = PAID_UNSENT status.base.order8 = PAID_TO_CONFIRM