1.概述
scala读取java项目下Src目录下的properties文件
package scalaimport java.util.Propertiesimport java.io.FileInputStreamimport scala.tools.scalap.Mainobject PropertiesScalaUtils {def loadProperties(key:String):Unit = {val properties = new Properties()val in = PropertiesScalaUtils.getClass.getClassLoader.getResourceAsStream("config_scala.properties")//val path = Thread.currentThread().getContextClassLoader.getResource("config_scala.properties").getPath //文件要放到resource文件夹下properties.load(in); println(properties.getProperty(key))//读取键为ddd的数据的值}}