1、必须是使用case 定义object类

package config
import org.apache.spark.sql.SparkSession
import org.apache.spark.{SparkConf, SparkContext}
case object conf {
val confs: SparkConf = new SparkConf().setMaster("local").setAppName("job")
val sc = new SparkContext(confs)
val spark: SparkSession = SparkSession.builder()
.appName("jobs").config(confs).getOrCreate()
}
05-23 08:42