Announcing Gluon Ignite: Easy JavaFX Dependency Injection


IgniteOne thing you should realize by now is that the Gluon team doesn’t sit still! In the past few days we’ve announced the release of Gluon Charm developer preview 4, IntelliJ live templates, and the JavaOne conference application. This is just the start – brace yourselves for a very busy October!

Today we are open sourcing a small library that our engineers built called Gluon Ignite. With this library, developers can use popular dependency injection frameworks in their JavaFX applications, including inside their FXML controllers. Gluon Ignite creates a common abstraction over several popular dependency injection frameworks (currently Guice, Spring, and Dagger, but we plan at add more as the demand becomes obvious). With full support of JSR-330 Gluon Ignite makes using dependency injection in JavaFX applications trivial. Here is a quick example of creating an application using the Guice framework and Gluon Ignite.

By using Gluon Ignite, you not only get dependency injection inside your application class, but also within your FXML controllers too. Even though the sample above shows a Guice context, as mentioned Gluon Ignite also supports other DI frameworks. By using a DaggerContext or SpringContext in your application, it can be easily set up to work with with those frameworks instead.

To use Gluon Ignite in your software, simply include it as a dependency in your preferred dependency manager. Shown below are examples of how to include Gluon Ignite and one specific implementation in your dependency chain:


Gluon Ignite with Dagger

Maven:
Gradle:

Gluon Ignite with Guice

Maven:
Gradle:

Gluon Ignite with Spring

Maven:
Gradle:

Note that ignite-common is automatically included as a dependency for each module, so it is not necessary to include this as a dependency.