Java 瓦丁10/11和嵌入式码头

Java 瓦丁10/11和嵌入式码头,java,spring,maven,embedded-jetty,vaadin10,Java,Spring,Maven,Embedded Jetty,Vaadin10,我在Vaadin 8.5.1上开发了中型应用程序。Jetty embedded 9.4.8用作Vaadin Servlet的Servlet容器。在Java代码中,我初始化Jetty实例,创建Vaadin servlet并将其附加到Jetty。在Maven中,我使用“vaadin Maven plugin”,它帮助我对文件夹进行正确的设置,包装也是“jar”。Spring(不是Spring引导)用于应用程序配置和IoC 现在我想将项目迁移到瓦丁10/11。我尝试了所有产生输出震击器的瓦丁起动器包。

我在Vaadin 8.5.1上开发了中型应用程序。Jetty embedded 9.4.8用作Vaadin Servlet的Servlet容器。在Java代码中,我初始化Jetty实例,创建Vaadin servlet并将其附加到Jetty。在Maven中,我使用“vaadin Maven plugin”,它帮助我对文件夹进行正确的设置,包装也是“jar”。Spring(不是Spring引导)用于应用程序配置和IoC

现在我想将项目迁移到瓦丁10/11。我尝试了所有产生输出震击器的瓦丁起动器包。但我不明白如何修改这些包来删除Spring Boot并获得一个嵌入Jetty的简单Maven项目

已在瓦丁论坛上提出问题:

您必须按如下方式配置Jetty服务器:

public class Application {

    public static void main(String... args) throws Exception {
        new Application().run(8080, "/");
    }

    public void run(int port, String contextPath) throws Exception {
        URL webRootLocation = this.getClass().getResource("/META-INF/resources/");
        URI webRootUri = webRootLocation.toURI();

        WebAppContext context = new WebAppContext();
        context.setBaseResource(Resource.newResource(webRootUri));
        context.setContextPath(contextPath);
        context.setAttribute("org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern", ".*");
        context.setConfigurationDiscovered(true);
        context.setConfigurations(new Configuration[]{
                new AnnotationConfiguration(),
                new WebInfConfiguration(),
                new WebXmlConfiguration(),
                new MetaInfConfiguration(),
                new FragmentConfiguration(),
                new EnvConfiguration(),
                new PlusConfiguration(),
                new JettyWebXmlConfiguration()
        });
        context.getServletContext().setExtendedListenerTypes(true);
        context.addEventListener(new ServletContextListeners());

        Server server = new Server(port);
        server.setHandler(context);

        server.start();
        server.join();
    }

}
此外,如果要将工件打包为uber jar,则需要使用
maven shade插件

您可以在以下位置找到Vaadin 12+的示例: