I think this issue identifies a problem caused by a deeper level of the Java 
stack: When will CDI become part of Java SE?

-----Original Message-----
From: openjfx-dev [mailto:openjfx-dev-boun...@openjdk.java.net] On Behalf Of 
Nitin Malik
Sent: Samstag, 21. November 2015 23:00
To: openjfx-dev@openjdk.java.net
Subject: JavaFX dependency injection

This was asked recently (
http://mail.openjdk.java.net/pipermail/openjfx-dev/2015-October/018080.html)
but I didnt see this addressed.

Are there plans to have better integration with DI frameworks for views and 
controllers?

For example, we have scenarios where multiple instances of the same view and 
controllers need to instantiated with different values. This is a frequent 
question that pops up on Stackoverflow and there apparently is no standard 
answer. It would help if suggested recipes and guidelines are made available.

The solutions we have adopted -
1. Use a controller factory to lookup Spring bean (this isnt ideal because the 
factory needs to be aware of the bean name).
1a. For singleton controllers, the lookup can be done via class name.
2. Use a controller factory that holds a reference to a controller that was 
constructed in code with the various parameters.
3. An Afterburner-like framework that scans controller for an annotation and 
injects the values.

Regards,
Nitin

Reply via email to