Any way to resolve class in object in Scala. I want to use an instance of Configuration class in Configuration object.
package application
import com.google.inject.Singleton
import play.api.Environment
@Singleton
class Configuration(env: Environment) {
private lazy val config = play.api.Configuration.load(env)
val venturesTime = config.getBoolean("ventures.time")
}
object Configuration {
}
òbject Configurationyou're already making a singleton object. 2. Having previously mentioned singleton object and a class with same name in the same source file, is called a companion object. For example, collection classes take advantage of this and one only needs to useval x = List(...), which utilizes apply method the singleton object. So, your question is not quite clear. Perhaps these notes will help you clarify it.new Configuration()inside the companion object.