Getting rid of web.xml in Vaadin 7 with VaadinServlet

↘锁芯ラ 提交于 2019-12-04 17:16:52

Here's for 7.x:

public class MyUI extends UI {

    @WebServlet(value = "/*", asyncSupported = true, initParams = {
            @WebInitParam(name = "ui", value = "com.example.MyUI"),
            @WebInitParam(name = "productionMode", value = "false") })
    public static class Servlet extends VaadinServlet {
    }

    @Override
    protected void init(VaadinRequest request) {
        ..
    }
}

And for 7.1 and newer:

public class MyUI extends UI {

    @WebServlet(value = "/*", asyncSupported = true)
    @VaadinServletConfiguration(productionMode = false, ui = MyUI.class)
    public static class Servlet extends VaadinServlet {
    }

    @Override
    protected void init(VaadinRequest request) {
        ..
    }
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!