samedi 10 octobre 2020

JavaFX fields injection in proxied controller

I'm using Spring to get a JavaFX proxied controller that contains @FXML annotated fields using the following code:

controllerProxy = applicationContext.getBean("controllerName");
FXMLLoader loader = new FXMLLoader(fxmlFilePath);
loader.setController(controllerProxy);
Parent root = loader.load();

However FXMLLoader uses reflection to set the controller fields, so it doesn't initialize the controller target variables, accessing only the proxy ones. How can I solve this issue?





Aucun commentaire:

Enregistrer un commentaire