good morning everyone. I'm starting to use vaadin 10, I'm trying to set items in a grid with Spring Jpa as follows, but for me it marks an error, this situation does not happen in the previous versions of vaadin.
@HtmlImport("styles/shared-styles.html") @Route("") public class MainView extends VerticalLayout {
@Autowired
private UserService userService;
private Grid<User> grid = new Grid<>();
public MainView() {
grid.setItems(userService.selectAll());
add(grid);
}
I got the following error:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.portal.app.spring.MainView': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.portal.app.spring.MainView]: Constructor threw exception; nested exception is java.lang.NullPointerException
.....
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.portal.app.spring.MainView]: Constructor threw exception; nested exception is java.lang.NullPointerException at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:182) ~[spring-beans-5.0.6.RELEASE.jar:5.0.6.RELEASE] at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:87) ~[spring-beans-5.0.6.RELEASE.jar:5.0.6.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1228) ~[spring-beans-5.0.6.RELEASE.jar:5.0.6.RELEASE] ... 72 common frames omitted Caused by: java.lang.NullPointerException: null
from what I understand, this is caused by @autowire in my service.
I hope someone shares with me an idea of ​​how I resolve the error, thanks :)