我一起使用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注入我的依赖项后,如何初始化我的课程?