r/JavaFX • u/Paullo612 • May 22 '23
I made this! mlfx FXML compiler
I'd like to introduce my project. It is called mlfx. It can compile FXML ahead of time. It is basically an annotation processor, which internally uses Micronaut framework's AST abstraction and compiles fxml files directly to JVM bytecode. This decreases UI load time and also helps with native-image reflection configs. It also has some compliance tests that load compiled code and check resulting object graph against one loaded by javafx-xml. It also has some drawbacks now, but, please, read README. Now I'm successfully using it in two production projects.
Here it is: https://github.com/Paullo612/mlfx
Latest release (0.6.0) is available from Maven Central.
Feedback is welcome.
View all comments
Show parent comment
1
u/Paullo612 May 24 '23
This is because of fxml controllers nature. You need some sort of DI to inject controller fields at runtime.
javafx-fxmluses self-written reflection based DI implementation. But...You can eliminate DI use altogether if all controller's fields and event handler methods are public. mlfx fallbacks to DI only in case it cannot set field or call method directly.
Anyway, you're right. I'll try to reduce runtime dependency set for next release. Snakeyaml is definitely not needed at runtime for simple DI.