I im trying to print "Hello" to console on application start. Can You explain how to do it?
What i tried myself:
app/modules/HelloModule.scala
:
package modules
import com.google.inject.AbstractModule
trait Hello {}
class MyHelloClass extends Hello {
initialize() // running initialization in constructor
def initialize() = {
println("Hello")
}
}
class HelloModule extends AbstractModule {
def configure() = {
bind(classOf[Hello])
.to(classOf[MyHelloClass]).asEagerSingleton
}
}
in conf/application.conf
i added:
play.modules.enabled += "modules.HelloModule"
and "Hello" is not printed when i run activator run
bind(classOf[MyHelloClass]).asEagerSingleton
. – Chetnikactivator run
i request localhost:9000/books (it's simple-rest-scala activator template) and "Hello" is not displayed – September