Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Simple Inversion of Control framework for Java/Scala

I am looking for a simple to use IoC container for GUI applications written in Java/Scala.

It should support Convention over Configuration, lifecycle management, configuration in code (preferably without any XML needed at all), and checking dependencies at compile-time as much as possible. Something similar to Autofac would be perfect.

like image 935
Alexey Romanov Avatar asked May 05 '10 18:05

Alexey Romanov


People also ask

What is Inversion of Control in Java with example?

The name “Inversion of Control” means that instead of you, the framework will be behind the steering wheel of the execution flow of your program, and that helps in decoupling the execution from the implementation, facilitating changes of different implemented code, modularization of the program and for last but not ...

What is Inversion of Control in framework?

Inversion of control is a software design principle that asserts a program can benefit in terms of pluggability, testability, usability and loose coupling if the management of an application's flow is transferred to a different part of the application.

What is dependency injection in Scala?

Dependency injection is a widely used design pattern that helps separate your components' behaviour from dependency resolution. Play supports both runtime dependency injection based on JSR 330 (described in this page) and compile time dependency injection in Scala.

What is difference between IoC and DI?

Dependency Injection is the method of providing the dependencies and Inversion of Control is the end result of Dependency Injection. IoC is a design principle where the control flow of the program is inverted. Dependency Injection is one of the subtypes of the IOC principle.


2 Answers

Sounds like you need something like Google Guice.

There used to quite a few IoC containers for Java (e.g. PicoContainer), but they've all been in the shadow of Spring for years now. Spring is likely a bit over the top for your needs, though.

Guice has restarted some healthy competition.

like image 138
skaffman Avatar answered Sep 30 '22 05:09

skaffman


If you are going pure Scala, you can take a look at Sindi: http://aloiscochard.github.com/sindi

Note: I'm the Sindi project author

like image 32
Alois Cochard Avatar answered Sep 30 '22 05:09

Alois Cochard