在Jetty中将Servlet持有者配置为Spring Boot嵌入式服务器

时间:2019-10-03 15:39:14

标签: spring rest spring-boot jetty jetty-9

我正在尝试将我们的旧码头应用程序迁移到Spring Boot应用程序中,其中码头将用于嵌入式服务器。

在Spring Boot中是否可以配置以下代码?

ServletHolder applicationHolder = new ServletHolder(new ServletContainer());
        applicationHolder.setInitParameter(org.glassfish.jersey.server.ServerProperties.PROVIDER_PACKAGES, packages);
        applicationHolder.setInitOrder(0);

        ServletContextHandler contextHandler = new ServletContextHandler(options);
        contextHandler.setContextPath(contextPath);
        contextHandler.addServlet(applicationHolder, "/*");

0 个答案:

没有答案