0

During

val value = Play.current.configuration.getString("confKey")

An exception or error caused a run to abort: There is no started application java.lang.RuntimeException: There is no started application

alessandrio
  • 4,282
  • 2
  • 29
  • 40
  • In Test (Spec) I have no problem with Play.current - this works. But it seems that during startup Lagom context Play application is not running up. I have not any idea how to get LagomApplicationContext from my services I can inject with wire() my implementation of LagomApplicationLoader but how provide configuration object ? – Dawid Furman May 31 '17 at 11:52

1 Answers1

0

You are accessing the global play instance when using Play.current. This is incorrect in many cases (during testing you may not have a started application).

You should use dependency injection to inject your configuration.

See: https://www.lagomframework.com/documentation/1.3.x/scala/DependencyInjection.html and https://www.playframework.com/documentation/2.5.x/ScalaDependencyInjection

vdebergue
  • 2,354
  • 16
  • 19