I have problem. This is my main:
    @SpringBootApplication
public class MyAppSpringApplication extends Application {
    public static ConfigurableApplicationContext springContext;
    private FXMLLoader fxmlLoader;
    public static void main(String[] args) {
        Application.launch(args);
    }
    @Override
    public void start(Stage stage) throws Exception {
        fxmlLoader.setLocation(getClass().getResource("/sample.fxml"));
        Parent root = fxmlLoader.load();
        stage.setTitle("Sample app");
        Scene scene = new Scene(root);
        stage.setScene(scene);
        stage.show();
    }
    @Override
    public void stop() throws Exception {
        springContext.stop();
    }
    @Override
    public void init() throws Exception {
        springContext = SpringApplication.run(MyAppSpringApplication.class);
        fxmlLoader = new FXMLLoader();
        fxmlLoader.setControllerFactory(springContext::getBean);
    }
}
And my first window (sample.fxml) with samplecontroller and sampleservice works ok. But i create another dish-builder.fxml with their contoller and service, but when i try to use my service there, it doesnt work because of null in dishbuilderservice (albo doesnt work sampleservice in that new controller). I heard that i shound also use that:
public static ConfigurableApplicationContext springContext;
but i have no idea how should i use it. Sorry for my weak knowledge and english.
     @Controller
    public class DishBuilderController implements Initializable {
    
        @Autowired
        DishBuilderService dishBuilderService;
    
        @Autowired
        SampleService sampleService;
    
        private void somefun(){
            sampleService.somefunInService(); //here sampleService and 
        every other service has null.
}
Here is the moment when i open new dishBuilder window (its in SampleController):
@FXML
    void addNoweOknoClicked(ActionEvent event) {
        try {
            Stage stage = (Stage)anchorPane.getScene().getWindow();
            FXMLLoader fxmlLoader = new FXMLLoader();
            fxmlLoader.setLocation(getClass().getResource("/dish-builder.fxml"));
            AnchorPane root = fxmlLoader.load();
            stage.setTitle("Sample app");
            Scene scene = new Scene(root);
            stage.setScene(scene);
            stage.show();
        }catch (IOException e){
            e.printStackTrace();
        }
    }
 
    