如何在 Quarkus 中创建应用程序 class?
How to create Application class in Quarkus?
在 getting started 指南中说:
With Quarkus, there is no need to create an Application class. It’s supported, but not required.
但没有显示如何创建应用程序class。
我如何制作一个?
这是在名为 Differences with vanilla JAX-RS 的注释中写的。 Application
class 指的是 JAX-RS Application
class。它通常看起来像这样:
import javax.ws.rs.ApplicationPath;
import javax.ws.rs.core.Application;
@ApplicationPath("/")
public class RestApplication extends Application {
}
也许更重要的是,请注意 "there is no need to create an Application class. It’s supported, but not required" 而不是 是指使用 public static void main(String[] args)
方法创建 class。 Quarkus 不支持(从 1.0 开始。0.Final;有计划在未来的版本中添加它)。
在 getting started 指南中说:
With Quarkus, there is no need to create an Application class. It’s supported, but not required.
但没有显示如何创建应用程序class。
我如何制作一个?
这是在名为 Differences with vanilla JAX-RS 的注释中写的。 Application
class 指的是 JAX-RS Application
class。它通常看起来像这样:
import javax.ws.rs.ApplicationPath;
import javax.ws.rs.core.Application;
@ApplicationPath("/")
public class RestApplication extends Application {
}
也许更重要的是,请注意 "there is no need to create an Application class. It’s supported, but not required" 而不是 是指使用 public static void main(String[] args)
方法创建 class。 Quarkus 不支持(从 1.0 开始。0.Final;有计划在未来的版本中添加它)。