开始体验
和Quarkus一起工作很容易。
步骤1
通过命令行界面安装
打开您喜欢的终端并使用JBang安装Quarkus CLI。您不需要首先安装Java。
对于Linux、macOS和Windows(使用WSL或bash兼容的shell,如Cygwin或MinGW)
curl -Ls https://sh.jbang.dev | bash -s - trust add https://repo1.maven.org/maven2/io/quarkus/quarkus-cli/
curl -Ls https://sh.jbang.dev | bash -s - app install --fresh --force quarkus@quarkusio
面向Windows使用Powershell
iex "& { $(iwr https://ps.jbang.dev) } trust add https://repo1.maven.org/maven2/io/quarkus/quarkus-cli/"
iex "& { $(iwr https://ps.jbang.dev) } app install --fresh --force quarkus@quarkusio"
If it's your first time to install, you'll need to restart your shell.
或者,您也可以用SDKMAN安装CLI!
sdk install quarkus
更多的选项,如Homebrew或Chocolatey,请参见Quarkus CLI指南。
步骤2
创建 "入门 "应用程序
在你的CLI中运行这个脚本:
quarkus create && cd code-with-quarkus
步骤3
运行 "入门 "应用程序
在你的CLI中运行这个脚本:
quarkus dev
当当当!您的Quarkus应用已经在localhost:8080
运行了
步骤4
使用Quarkus进行实时编码
Quarkus makes it easy to change your code on the fly. Let's modify the RESTful endpoint
Open src/main/java/org/acme/GreetingResource.java
in a text
editor or your favorite
IDE and change "Hello from RESTEasy Reactive" to "Hola from RESTEasy
Reactive". Then refresh the browser and see the changes.
@Path("/hello")
public class GreetingResource {
@GET
@Produces(MediaType.TEXT_PLAIN)
public String hello() {
return "Hello RESTEasy";
}
}
很Cool的东东对吧?了解更多Quarkus的开发模式。
Next Steps
Start with Serverless
Create a portable Java API to write serverless functions deployable to AWS Lambda, Azure Functions, Knative, and more.
Quarkus Tools in Your Favorite IDE
Every developer has their favorite IDE. Learn how to use Quarkus in yours.
Writing JSON REST services
JSON is now the lingua franca between microservices. See how you can get your REST services to consume and produce JSON payloads.
Deploying Quarkus Applications on Kubernetes
This guide covers how to deploy a native application on Kubernetes.