Skip to content

Latest commit

 

History

History
47 lines (35 loc) · 2.21 KB

README.md

File metadata and controls

47 lines (35 loc) · 2.21 KB

Examples of dependency injection in Scala

All of the example projects are build using SBT.

cake

An example of the Cake Pattern.

scala-cdi

This project shows the use of Contexts and Dependency Injection in Scala. It is not set up to be run directly from SBT and needs to be deployed to a Java EE 6 compliant container like JBoss 7 or a servlet container with CDI implementation like Tomcat + Weld.

After deploying you can see it in action by accessing the CoffeeServlet at http://host:port/scala-cdi/coffee.

scala-guice

This project shows the use of Google Guice in Scala. Both in its pure form and with a thin Scala wrapper.

The functionality is demonstrated in the test suite ExampleSuite that you can run by invoking sbt test.

scala-spring

This project shows the use of the Spring Framework in Scala.

The it is quite similar to the scala-cdi project but it can be run directly from SBT using the Jetty plugin by running sbt console and invoking container:start. The CoffeeServlet then can be accessed at localhost:8080/coffee. You stop the embedded Jetty container by invoking container:stop.

scala-spring-functional

This (perhaps poorly named) project shows the use of Spring Scala.

It is almost exactly the same as scala-spring but it uses the functional configuration from the Spring Scala project.

It can be run directly from SBT using the Jetty plugin by running sbt console and invoking container:start. The CoffeeServlet then can be accessed at localhost:8080/coffee. You stop the embedded Jetty container by invoking container:stop.

subcut

This project demonstrates the use of SubCut.

You can run it by invoking sbt run.