import org.springframework.core.io.support.PropertiesLoaderUtils; Properties properties = PropertiesLoaderUtils.loadAllProperties("test.properties"); String test = properties.getProperty("test"); System.out.println("properties.test:"+test);
//不须要加.properties后缀名,只须要文件名便可 //test. properties配置文件在com.test.config下面,则wei com/test/config/test ResourceBundle resource = ResourceBundle.getBundle("test"); String test = resource.getString("test"); System.out.println("resource.test:"+test);