§The Typesafe Config API
Play uses the Typesafe config library as the configuration library. If you’re not familiar with Typesafe config, you may also want to read the documentation on configuration file syntax and features.
§Accessing the configuration
Typically, you’ll obtain a Config
object through Dependency Injection, or simply by passing an instance of Config
to your component:
/*
* Copyright (C) Lightbend Inc. <https://www.lightbend.com>
*/
package controllers
import com.typesafe.config.Config;
import javax.inject.Inject;
import play.mvc.Controller;
public class MyController extends Controller {
private final Config config;
@Inject
public MyController(Config config) {
this.config = config;
}
}
§API documentation
Since Play just uses Config
object, you can see the javadoc for the class to see what you can do and how to access configuration data.
Next: HTTP programming
Found an error in this documentation? The source code for this page can be found here. After reading the documentation guidelines, please feel free to contribute a pull request. Have questions or advice to share? Go to our community forums to start a conversation with the community.