Documentation

You are viewing the documentation for the 2.7.0-M4 development release. 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) 2009-2018 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