I have a Vaadin7 application I am trying to move to Vaadin12 and there is a line of code where I call VaadinServlet.getCurrent() to get the servlet ( I actually need to configuration information ). It is returning null. What is happening and how can I fix?
Obviously, this line of code works fine in Vaadin7.
Ok, it was a simple solution: I just had to change import com.vaadin.server.VaadinServlet;
to import com.vaadin.flow.server.VaadinServlet;
. There is a addon we use that seems to reference vaadin 7 stuff, and thus neither of us noticed the wrong import statement. Either we should have stopped using this addon or updated it to the latest version.
Lesson to learn from this: make sure you are no referencing Vaadin 7 via depencies in your pom, I guess.