Documentation

You are viewing the documentation for the 2.8.8 release in the 2.8.x series of releases. The latest stable release series is 3.0.x.

§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 play.mvc.Controller;

import javax.inject.Inject;

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