scalaplayframeworklagom

Where exactly does application.conf live in the project directory structure?


The Play website says it should be in "conf", but the Lagom default HelloeWorld example places it under the "resources" directory within /applicationProject/src/main". "conf/" does not even show up anywhere in the directory structure in Lagom. Can someone clarify?


Solution

  • According to default Play project layout application.conf located at conf/application.conf. So if you will inject play.api.Configuration this will represent parsed and loaded config from that file.

    On another hand I suppose, Lagom is library, which relies on default Maven project layout, which differs from default Play layout, in which src/main/resources is standard folder for resources like configuration, which is why in Lagom project example you see application.conf in another folder then in Play.

    What you can do as an option: take play.api.Configuration.underlying and pass manually to Lagom code.

    Or keep using standard Maven project layout for Play via special plugin introduced after version 2.6.8: https://www.playframework.com/documentation/2.6.x/Highlights26#PlayService-sbt-plugin-(experimental)

    Hope this helps!