[REVIEW] Make controller instantiation customizable

Greg Brown greg.x.brown at oracle.com
Thu Dec 15 07:21:19 PST 2011

> What's missing finally to get full power is that field bindings could go
> through a method instead of a field else we can't use Interfaces as types.

When you say "bindings", I assume you mean controller field injection? There is actually already a JIRA ticket for this:


I was initially opposed to this because bean properties are inherently public, so you may end up exposing values in your controller that should otherwise be private or protected. However, if we supported private or protected property setters via the @FXML annotation (like we do with fields), we could get around this. Not a bad idea.

Either way, you don't really need this in order to inject fields into an interface-based controller - FXMLLoader performs reflection on the actual type of the instantiated controller, not the type specified in the fx:controller attribute. So basically, it will look for fields on whatever type your controller factory returns.

More information about the openjfx-dev mailing list