JavaFX FXML在注入Weld依赖项之前初始化fires

时间:2017-09-04 07:58:15

标签: java fxml weld

我一起使用FXML和Weld SE。到目前为止,除了某些情况外,它的效果很好。

public class ApiController extends AnchorPane implements Initializable {

    @Inject
    private ApiFactory        apiFactory;
    @FXML
    private TextArea          requestArea;
    @FXML
    private TextArea          responseArea;

    public ApiController() {
        // creates FXML loader, sets weld controller factory, and assigns "this" to root/controller.
        ControlCenter.loadFxml("/view/api.fxml", this);
    }

    @Override
    public void initialize(URL location, ResourceBundle resources) {
        // breakpoint here will show "apiFactory" null
    }

}

我需要进行初始化,但只有在Weld注入ApiFactory实现之后。但是,在调用initialize之后会发生注入。在Weld注入我的依赖项后,如何初始化我的课程?

0 个答案:

没有答案