Questions tagged [scaldi]

Lightweight Scala Dependency Injection Library.

Scaldi provides simple and elegant way to do dependency injection in Scala.

33 questions
1
vote
1 answer

ReactiveMongo ConnectionNotInitialized In Test After Migrating to Play 2.5

After migrating my Play (Scala) app to 2.5.3, some tests of my code using ReactiveMongo that once passed now fail in the setup. Here is my code using ScalaTest: def fixture(testMethod: (...) => Any) { implicit val injector = new…
Vidya
  • 29,932
  • 7
  • 42
  • 70
1
vote
2 answers

Play 2.4 Scaldi WS tests

I want to test a WS client with a fake server like it's explained in the Play 2.4 documentation here : https://www.playframework.com/documentation/2.4.x/ScalaTestingWebServiceClients But I'm doing DI with Scaldi and i'm not able to adapt the Play's…
Jules Ivanic
  • 1,579
  • 2
  • 15
  • 28
1
vote
1 answer

Scaldi : Bind[T < AkkaInjectable] to TestProbe.ref

I'm trying to test an Actor A inside my Play 2.4 application with Scaldi. This actor is calling injectActorRef[B] that I want to mock with a TestKit.TestProbe. Inside my specs2, I would like to be able to retrieve the probe for mocked B while…
Thomas Pocreau
  • 470
  • 5
  • 12
1
vote
1 answer

message goes to dead letter instead of sender (akka router) [scala]

Actually I`m having trouble with getting my actor (router) system to work correctly. My Setup: I`m trying to use an akka router within an play controller. For dependency injection I use scaldi. scaldi module: class UserDAOModule extends Module { …
heiningair
  • 441
  • 1
  • 6
  • 23
1
vote
1 answer

Scaldi bindings to provider function (Map argument with injected key & value)

I'm trying to port this repo from Guice to Scaldi. I'm stack in this code from /app/utils/di/SilhouetteModule.scala (lines 60-65): Map( credentialsProvider.id -> credentialsProvider, facebookProvider.id -> facebookProvider, …
Mironor
  • 1,157
  • 10
  • 25
1
vote
3 answers

Managed controllers in Play 2.3 with DI (Scaladi / Guice)

thank you in advance for taking the time to take a look at my current problem with play. I am still trying out the Playframework, currently in version 2.3. At the moment I try to figure dependency injection out. I followed the tutorials provided in…
Klink
  • 145
  • 2
  • 11
0
votes
1 answer

Play 2.6.13 having trouble running with Scaldi

I tried to upgrade our applications which use Scaldi injection from Play 2.6.12 to Play 2.6.13. On all applications we run into the same problem. It tries to instantiate an object of type '$$anon$1' or 'play.api.inject.BindingKey$$anon$1@5d807417'…
dingdong
  • 169
  • 10
0
votes
0 answers

Scaldi - default binding with override

I would like to inject two different instances of my database wrapper class (DB): a default instance and a readonly instance. 99% of usages of the class use the default instance. I would therefore like to be able to use the simple inject[DB] to get…
Justin Moore
  • 39
  • 1
  • 6
0
votes
1 answer

Scaldi dependency injection with Constructor

I have three classes class A, class B and class C. I want to inject Class A and Class B as a dependency through constructor to Class C. I am using ScalDI dependency injection framework. Can someone tell me how I can do it? class A { ...} class B…
user1733735
  • 423
  • 1
  • 6
  • 20
0
votes
1 answer

How to use Scaldi Conditions to do default binding

I am using Scaldi with Play and Slick in my application. I need to bind a DatabaseConfig dependency to different configurations depending on some condition. Mode = Dev => Oracle DB Mode = UAT => Another Oracle DB ... Mode = Test => Local H2 DB No…
pumpump
  • 361
  • 2
  • 15
0
votes
1 answer

Scaldi: couldn't find bindings defined in typesafe config

Here is the issue. Let assume I have two mutable modules: class DbModule extends Module { bind[JdbcBackend#Database] toProvider inject[JdbcDriver].backend.Database.forURL( inject[String]("db.url"), inject[String]("db.username"), …
0
votes
1 answer

In Scaldi, I loaded my own typesafe config, how can I set Scaldi to make it available?

I want to load my own config from a configuration file. After loading the config I want to be able to inject the config values using Scaldi. Here is the code where I load the typesafe config. How can I adjust this code so that I can use this module…
Phil
  • 46,436
  • 33
  • 110
  • 175
0
votes
1 answer

How should one implement a Scaldi Module in regards to testing and mocks (un familiar to that module)?

I have an implicit scaldi Module in my root package object so that any component can use the injector implicitly. This module looks like this: val additionalModule = new AtomicReference[Module](new Module {}) lazy val applicationModule =…
Yoav Sadeh
  • 31
  • 4
0
votes
1 answer

How do I register a binding with both delayed instantiation and as a singleton

I am new to scaldi. I have a class being used in my cloud environment configuration where I want two things to happen. bind [EnvironmentInfo] to new EnvironmentInfo initWith(_.init()) First, I want it to be a singleton. It retrieves the runtime…
S. Hebert
  • 808
  • 1
  • 8
  • 18
0
votes
1 answer

Compilation error when using Scaldi

I am following the steps mentioned in Scaldi documentaiton. Following is my code. class Game(players: List[Player], currentPlayer: Player, board: Board, active: Boolean, gamePersistor: GamePersistor) extends Injectable { def…
Can't Tell
  • 12,714
  • 9
  • 63
  • 91