Home > Blockchain >  Vaadin 23 cannot import annotation @VaadinServletConfiguration
Vaadin 23 cannot import annotation @VaadinServletConfiguration

Time:06-17

In the Vaadin 23 documentation, precisely here it show an example which includes the java annotation @VaadinServletConfiguration.

@WebServlet(urlPatterns = "/*", name = "myservlet", asyncSupported = true, initParams = {
@WebInitParam(name = "frontend.url.es6", value = "http://example.com/es6/"),
@WebInitParam(name = "frontend.url.es5", value = "http://example.com/es5/") })
@VaadinServletConfiguration(productionMode = false)
public class MyServlet extends VaadinServlet {}

But when I try to use it in my project, maven can't find the class, or better it suggests some dependencies but when I import them I still can't import the class.

Any ideas what I'm doing wrong?

CodePudding user response:

@VaadinServletConfiguration annotation has been deprecated in V14, and it is completely removed in V23. You can configure the parameters without the annotation though by doing something like:

@WebServlet(urlPatterns = "/*", name = "myservlet", asyncSupported = true, initParams = {
        @WebInitParam(name = "heartbeatInterval", value = "700")
})
public class MyServlet extends VaadinServlet {
}

(the docs will be updated shortly).

  • Related