I am new to vaadin flow. I am trying to create a list view by following tutorial provided on site. https://vaadin.com/docs/v14/flow/tutorials/in-depth-course/configuring-vaadin-grid
@Route("")
public class MainView extends VerticalLayout {
private ContactService contactService;
private Grid<Contact> grid = new Grid<>(Contact.class);
public MainView(ContactService contactService) {
this.contactService = contactService;
addClassName("list-view");
setSizeFull();
configureGrid();
add(grid);
updateList();
}
private void configureGrid() {
grid.addClassName("contact-grid");
grid.setSizeFull();
grid.setColumns("firstName", "lastName", "email", "status");
}
private void updateList() {
grid.setItems(contactService.findAll());
}
}
Here when i am executing updateList() method i am getting nullPointerExecption on service instance. I tried using repository.findAll() but facing same issue.
To check the if there is issue in service I created REST API and called the same method in service here i am getting proper result. Please help.
This is the error I am getting.
There was an exception while trying to navigate to '' with the exception message 'Error creating bean with name 'com.example.demo.ui.MainView': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.example.demo.ui.MainView]: Constructor threw exception; nested exception is java.lang.NullPointerException'