簡體   English   中英

Vaadin 14 不帶 Maven 和不帶 Spring 引導

[英]Vaadin 14 without Maven and without Spring Boot

我想在不使用 Maven 或 Spring 引導的情況下創建 Vaadin 14 應用程序。 只是一個帶有嵌入式 Jetty 服務器的普通 Java 應用程序。 這在過去是可能的。 以某種方式仍然可能嗎?

Vaadin 6.x 和 Jetty 的舊代碼:

private static void initServer(Settings settings) throws Exception, InterruptedException {
    httpPort = settings.getInt("webapp.port", 8888);
    final Server server = new Server(httpPort);
    final WebAppContext webapp = new WebAppContext();
    webapp.setContextPath("/");
    webapp.setResourceBase("WebContent");
    webapp.setClassLoader(Thread.currentThread().getContextClassLoader());
    server.setHandler(webapp);
    server.start();
    server.join();
}

Yes it's possible, you have a metric buttload of extra work to do by not using a build tool (any java build tool. eg: maven, gradle, ant+ivy, leiningen, grape, buildr, bazel, etc...),但這是可能的。

您將有許多 jars 需要管理,不僅在 Jetty 內,還有在 Jetty 之外的依賴項(如各種規格 api jars)。

然后,您將對嵌入式碼頭的使用進行一些更改。

您需要進行的更改取決於您打算使用的 Jetty 版本。

You are going from Jetty 6.x, which was for Servlet 2.1 on Java EE 4. Since then there's been a tremendous amount of changes in the various EE specs, the HTTP specs, and even Java JVM itself that has caused changes down to Jetty .

Vaadin 本身提供了幾個不同的 Vaadin 14 示例項目,帶/不帶 Spring 和不同的構建工具。 Gradle 通常用作 Maven 的替代品,並且可以在沒有任何 CDI 的示例中找到普通的 Java 樣式。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM