Skip to content
Advertisement

Vaadin object is not an instance of declaring class

I’m trying to call a method in class named (DataActions) to the dashboard view so the grid can be able to receive the objects given after the method execution, but still no luck solving this error (java.lang.IllegalArgumentException: object is not an instance of declaring class).

-Class (DataSession) is the class responsible for opening the database session. -Class (DataActions) is the class responsible for the methods used to extract information from the database using a session created by an (DataSession object) -Method updateGrid calls a method in (DataActions) using an object created.

This project was created with vaadin hello world example project, so it uses springboot (version 2.4.5) and vaadin flow (version 14.7.0).

–Dashboard View–

JavaScript

–DataActions class–

JavaScript

–Pom.xml file–

JavaScript

Advertisement

Answer

I have found the solution, I was missing the annotation @Component in the class where the method is, and the annotation @Autowired where I want the instance of the class to be created.

Advertisement