Java tutorial
package io.devpage.util; import java.io.InputStream; import java.util.Iterator; import java.util.Map.Entry; import java.util.Properties; import org.springframework.beans.factory.InitializingBean; /* * Copyright 2015 SongJian 491835898@qq.com * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ public class ReadMethodPerformanceInterceptorConfig implements InitializingBean { public static String matchNameLike = null; public static String matckKey = "matchLike"; @Override public void afterPropertiesSet() throws Exception { Properties prop = new Properties(); InputStream in = ReadMethodPerformanceInterceptorConfig.class.getResourceAsStream("/p9e.properties"); prop.load(in); Iterator<Entry<Object, Object>> itr = prop.entrySet().iterator(); while (itr.hasNext()) { Entry<Object, Object> e = (Entry<Object, Object>) itr.next(); if (e.getKey().toString().equalsIgnoreCase(matckKey)) { matchNameLike = e.getValue().toString(); break; } } if (matchNameLike == null) { throw new Exception("?matchMethodClassNameLike?,??"); } } }