@Autowired
private CategoryService categoryService;
@Autowired
private ReviewService reviewService;
private final TextField searchField = new TextField("", "Search categories");
private final H2 header = new H2("Categories");
private final Grid<Category> grid = new Grid<>();
private CategoryEditorDialog form;
public CategoriesList() {
form = new CategoryEditorDialog(
this::saveCategory, this::deleteCategory, this.categoryService, reviewService);
initView();
addSearchBar();
addContent();
updateView(categoryService);
}
when I want to use springDataJpa + herbernate to persist data in mysql in this demo , I found it failed. because when i access the url localhost:8080 in Chrome , the Class CategoriesList create a new instance,but it will occur nullpointerException,the categoryService and reviewService will be null. So how could I set the origin data queried from the database when initialize the instance?