The play documentation about functional tests in java shows two modes
I would like to use dependency injection but I have to set custom configuration on application startup like the use of in memory database.
I cannot achieve to do that. I guess this has to be done in the guice builder but I don't know how.
I am assuming you are using Guice for DI.
The discussion on issue 4809 on the framework's github repo should help on answering your question.
I was able to make it work using one of the solutions on the issue:
new GuiceApplicationBuilder()
.configure((Map) Helpers.inMemoryDatabase())
.in(Mode.TEST)
.build();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With