Initialize javafx beans - XDean/javafx-spring-boot GitHub Wiki

  • In javafx, we use Initializable to init controllers.
  • In spring, we use InitializingBean to init beans.

In javafx-spring-boot, we use FxInitializable to init javafx beans managed by spring (usually means controller).

@FxThread
public interface FxInitializable {
  void initAfterFxSpringReady();
}

initAfterFxSpringReady will be executed in javafx UI thread after both spring and fxml beans injected.

  • If you use Initializable, notice that spring properties (@AutoWired) may not set.
  • If you use InitializingBean, notice that javafx properties (@FXML) may not set.