i am developing an Javafx application with Spring Security enabled in it. then, i have created a fxml form which have a textField with id equals to txtField. later i anottated a method with @Secured Anottation, but when i try to set text to textField i get a NullPointerException.
Controller Class is as follow:
@Controller
public class ControladorInicio {
@FXML
private ResourceBundle resources;
@FXML
private URL location;
@FXML
public TextField textField;
@FXML
@Secured("ROLE_OFERTA_ADMIN")
public void onButton3(ActionEvent event) {
System.out.println("has permission");
}
@FXML
public void initialize() {
textField.setText("This is a text"); //I get a null pointer exception here
}
}
i suspect javafx is not injecting properties fields to the controller when i use @Secured. but, when i comment the @Secured anottation all is fine.