Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reading Configuration in Play (2.6.5) with Scala without @Inject

I'm using Play 2.6.5 with Scala. Most of the times reading from the configuration works with injecting the configuration.

In some parts it would be too difficult to get a class into injection scope.

Is there a way to get the configuration object without injection?

like image 548
KingOfCoders Avatar asked Jan 01 '26 13:01

KingOfCoders


1 Answers

You can use ConfigFactory ->

ConfigFactory.load().getString("db.url")

import for the same ->

import com.typesafe.config.ConfigFactory
like image 103
geek94 Avatar answered Jan 03 '26 12:01

geek94



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!