1 Star 7 Fork 6

Patrick-老王 / quarkus-petclinic

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README

quarkus-petclinic project!

This project uses Quarkus, the Supersonic Subatomic Java Framework.

If you want to learn more about Quarkus, please visit its website: https://quarkus.io/ .

开发模式运行程序

开发环境 且 自动加载变更:

./mvnw quarkus:dev

开发环境使用不同profile:

./mvnw quarkus:dev -Dquarkus-profile=prod

打包并运行程序

The application can be packaged using ./mvnw package -Dmaven.test.skip=true. It produces the quarkus-petclinic-1.0.0-SNAPSHOT-runner.jar file in the /target directory. Be aware that it’s not an über-jar as the dependencies are copied into the target/lib directory.

The application is now runnable using java -jar target/quarkus-petclinic-1.0.0-SNAPSHOT-runner.jar.

打包Native程序

注意,在非dev环境下禁止使用h2, native也不支持H2

Docker启动MySQL

  1. 启动5.7.8 mysql
    docker run -d -e MYSQL_USER=petclinic -e MYSQL_PASSWORD=petclinic -e MYSQL_ROOT_PASSWORD=root -e MYSQL_DATABASE=petclinic -p 3306:3306 mysql:5.7.8
  2. 创建DB、表,使用 src/main/resources/mysql/schema.sql
  3. 初始化数据,使用 src/main/resources/mysql/import-mysql.sql

使用本地安装的GraalVM打包Native

跳过

使用Docker打包Native

使用Docker无需安装GraalVM

使用Docker打包Native: ./mvnw package -Dmaven.test.skip=true -Pnative -Dquarkus.native.container-build=true -Dquarkus.container-image.build=true.

制作Docker镜像

JVM镜像

docker build -f src/main/docker/Dockerfile.jvm -t quarkus-quickstart/pet_clinic_jvm .

完成后镜像大小约为:534MB

native镜像

docker build -f src/main/docker/Dockerfile.native -t quarkus-quickstart/pet_clinic_native .

完成后镜像大小约为:202MB

启动Docker容器

JDK11 默认只在2G及以上才能使用G1,否则使用CMS

JVM镜像启动容器

docker run -m 2g -p 8080:8080 quarkus-quickstart/pet_clinic_jvm

能在启动日志看到如下内容:

INFO  [io.quarkus] (main) quarkus-petclinic 1.0.0-SNAPSHOT on JVM (powered by Quarkus 1.8.1.Final) started in 4.047s. Listening on: http://0.0.0.0:8080
INFO  [io.quarkus] (main) Profile prod activated.

Native镜像启动容器

docker run -m 2g -p 8080:8080 quarkus-quickstart/pet_clinic_native

能在启动日志看到如下内容:

INFO  [io.quarkus] (main) quarkus-petclinic 1.0.0-SNAPSHOT native (powered by Quarkus 1.8.1.Final) started in 0.047s. Listening on: http://0.0.0.0:8080
INFO  [io.quarkus] (main) Profile prod activated.

空文件

简介

基于 https://github.com/danieloh30/quarkus-petclinic 微调后的 Quarkus Petclinic项目 展开 收起
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
Java
1
https://gitee.com/patrick-wong/quarkus-petclinic.git
git@gitee.com:patrick-wong/quarkus-petclinic.git
patrick-wong
quarkus-petclinic
quarkus-petclinic
master

搜索帮助