Questions tagged [scaldi]

Lightweight Scala Dependency Injection Library.

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

33 questions
19
votes
1 answer

Comparing Subcut and Scaldi

I am looking at SubCut and Scaldi to use in my projects. The examples provided in their respective Getting Started documents seem very similar. Neither project seems to provide documentation beyond Getting Started and scala docs. Could somebody…
Daniel Mahler
  • 7,653
  • 5
  • 51
  • 90
7
votes
2 answers

Implicit abstract class constructor parameter and inheritance in Scala

I am fairly new to Scala and have been trying to learn and understand implicit conversions and parameters and have encountered a scenario that I find confusing. For context, I am using Scaldi to do dependency injection in an Akka application and…
simonl
  • 1,240
  • 7
  • 19
5
votes
1 answer

How to inject Database in Play Framework (Scala, Scaldi) if we use specific datasource?

I want to use Anorm as DB library and Scaldi as DI in my play framework project. But now I couldn't inject Database since in newest play framwork, we cannot use DB.getConnection("datasource") anymore. Any of you guys could explain how to convern…
Made Raka
  • 85
  • 1
  • 4
5
votes
1 answer

What is the difference between Scaldi and Guice

I am now working in a project that uses Scaldi, I am learning it, and looks good so far, but I still did not figure out the actual functionalities that it offers over guide/juice. What are the actual differences between the 2 frameworks? Is Scaldi…
Filipe Miranda
  • 914
  • 1
  • 20
  • 33
3
votes
1 answer

Scaldi dependency injection and Akka Actors

I'm currently exploring using Scaldi for Dependency Injection in a Play2.2 application. I have read the documentation on Scaldi's website, but what is unclear to me is how to use it with Akka. What I have so far in my project: Models/ (Daos and case…
James Cowhen
  • 2,837
  • 3
  • 24
  • 32
2
votes
1 answer

How to use Scaldi to inject an Akka Router?

I am creating the router from Akka configuration. val router = context.actorOf(FromConfig.props(MyActor.props), "router") I want to unit test the Actor that the router is in, and being able to inject the router into the Actor would be helpful. Is…
Nelson
  • 2,972
  • 3
  • 23
  • 34
2
votes
0 answers

Specs2 with Scaldi - wrong implicit injector being invoked

I'm trying to run a test with scaldi and specs2. In the test I need to override a StringManipulator function that uses an injected ProxyManipulator. The ProxyManipulator takes a string and returns its upper case in a Future. The replacement…
Yossi Chen
  • 226
  • 3
  • 11
2
votes
2 answers

Depedency injection framework of Play and Scala?

I am from spring background, where we use Dependency Injections in our projects. Now i am on Play-Framework, where i am select Scala for development. With Scala i want to use dependency injection and i find out there are so many Dependency…
Harmeet Singh Taara
  • 6,483
  • 20
  • 73
  • 126
2
votes
1 answer

Injecting dependencies in tests in Play framework with scaldi

I'm looking for a way to inject a dependency into a Test (in /tests/models/) that looks like following: class FolderSpec(implicit inj: Injector) extends Specification with Injectable{ val folderDAO = inject [FolderDAO] val user =…
Mironor
  • 1,157
  • 10
  • 25
2
votes
1 answer

Is it possible to inject into an scala object with scaldi dependecy injection?

Is it possible to inject into an scala object with scaldi dependecy injection? If so, how can I get the injector? I have an object SignUpForm which has to be a singleton... object SignUpForm { val form = Form( mapping( "firstName" ->…
heiningair
  • 441
  • 1
  • 6
  • 23
2
votes
1 answer

Scaldi - binding to single/multiple instances

I recently switched from SubCut to Scaldi and there's a feature I find undocumented/missing: In SubCut, when you define a binding, you can choose between different binding modes - toSingle, toProvider, to moduleInstanceOf, toModuleSingle, which…
nietaki
  • 8,758
  • 2
  • 45
  • 56
1
vote
1 answer

What is the purpose of scaldi Module

It seems like i am able to inject Services or Akka Actors without the use of Module. May i know what is the purpose of Module then? class Hello(implicit inj:Injector) extends Controller with AkkaInjectable { val greetingService =…
laiboonh
  • 1,377
  • 1
  • 9
  • 19
1
vote
0 answers

When to use inject vs injectActorRef in Scaldi?

Using Scaldi I want to inject Actors into other Actors. When should I use inject vs injectActorRef? For example, in the Module I have a binding that looks like this: binding toProvider new SomeActor(). When injecting SomeActor which method should I…
Nelson
  • 2,972
  • 3
  • 23
  • 34
1
vote
0 answers

Starting Scala Play App with Scaldi using Java

I built a Scala Play app with Scaldi for DI. I used sbt:assembly to generate a fat jar which I'm hoping to be able to start up by simply using java -jar /path/to/jar with some additional configs. It seems however when I do this I get a bunch of…
Steve Y.
  • 87
  • 1
  • 6
1
vote
0 answers

Impossible to inject Slick DatabaseConfigProvider in scaldi and play 2.5

I'm having a issue to inject the slick DatabaseConfigProvider in Scaldi. It was working fine in play 2.4 but I had to migrate to 2.5. Here is my configuration : play 2.5.3 scaldi-play 0.5.15 play-slick 2.0.0 My…
Mael Razavet
  • 202
  • 2
  • 11
1
2 3