liveBook · Manning

ConfigFactory

As explained in Akka in Action, Second Edition

ConfigFactory is the Typesafe Config API object that loads and constructs configuration values from resources, files, URLs, and system properties.

ConfigFactory is the Typesafe Config API entry point for loading configuration values. It builds a hierarchical configuration tree from application resources and supports defaults, overrides, and environment-specific selection. section 7.1 section 7.1.4

Load the default configuration

import com.typesafe.config.ConfigFactory val config = ConfigFactory.load() section 7.1

Choose a configuration source or override strategy when the default application files are not sufficient:

  • Call ConfigFactory.load("myapp") to load myapp.conf, myapp.json, or myapp.properties instead of the application-named files. section 7.1.4
  • Use -Dconfig.resource for a resource name, -Dconfig.file for a filesystem path, or -Dconfig.url for a URL. section 7.1.4
  • Let higher-priority configuration values override definitions supplied by lower-priority defaults. section 7.1.4
Figure 7.1 Configuration example
CH07_F01_Abraham2

Use the configuration hierarchy diagram to see how application properties are grouped beneath a named node. section 7.1

How Akka in Action, Second Edition covers it

How deep it goes
Explains hierarchical loading, fallback priority, alternate filenames, and system-property selection without detailing configuration value access.
Examples
Uses ConfigFactory.load(), a grouped application-property hierarchy, myapp.conf selection, and -Dconfig.file.
What it assumes
Assumes basic application startup and introduces configuration hierarchies, fallback files, and Java system-property selection.
What you can do after
Operate/configure applications by loading defaults, choosing named resources, and overriding sources with system properties.
How it connects
Connects configuration hierarchy, configuration files, fallback configuration, and Java system properties.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Akka in Action, Second Edition. The section links point to the parts of the book it draws on.