idea中spark項目Scala語言讀取properties文件


1.將文件放入resources目錄下面,將文件設置成resources

file->Project Structure->Modules

選擇文件,然后點擊resources

2.在類中加入代碼

val properties = new Properties()
val in = this.getClass().getClassLoader().getResourceAsStream("my.properties");
properties.load(in)


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM