Access & serve zserio services via REST/OpenAPI using Java with Spring Boot technology stack.
- JDK 17+
- Maven 3.6
The infrastructure to build native images (executables as well as corresponding Docker images) is present but the built modules do not work at the moment.
mvn install
or run script
build-java.sh
mvn -Pdocker-java spring-boot:build-image
or run script
build-docker-java.sh
mvn -Pnative verify
with GraalVM used as default JDK and native plugin installed
or run script
build-native.sh
with environment variable $GRAALVM_HOME pointing to GraalVM directory and native plugin installed
mvn -Pdocker-native spring-boot:build-image
or run script
build-docker-native.sh
.../zswag-java/server/generated-openapi/openapi.yaml
.../zswag-java/openapi-client/generated-client
java -jar server/targetJava/server-0.0.1-SNAPSHOT-boot.jar
# press Ctrl+C to quit the server
Example using docker compose:
version: '3'
services:
server:
image: "zswag.java/server:0.0.1-SNAPSHOT"
environment:
- JAVA_OPTS=-Dspring.profiles.active="default"
volumes:
- /tmp:/tmp
- /mnt:/mnt:ro
- ./log-server:/logs
ports:
- "5000:5000"
network_mode: bridge
restart: always
Create Docker container and start it:
docker-compose up -d
java -Dspring.profiles.active="default" -jar client/targetJava/client-0.0.1-SNAPSHOT-boot.jar
Addition to docker compose example above:
...
client:
image: "zswag.java/client:0.0.1-SNAPSHOT"
depends_on:
- "server"
environment:
- JAVA_OPTS=-Dspring.profiles.active="default" -Dspring.config.additional-location="file:/config/"
volumes:
- /tmp:/tmp
- /mnt:/mnt:ro
- <local file path for external config file>:/config
- ./log-client:/logs
network_mode: bridge
In the local config file named application.yml you have to override "localhost" with the concrete machine ip address, e.g.
feign:
url: 192.168.168.1:5000
java -Dspring.profiles.active="default" -jar openapi-client/targetJava/openapi-client-0.0.1-SNAPSHOT-boot.jar
Addition to docker compose example above:
...
openapi-client:
image: "zswag.java/openapi-client:0.0.1-SNAPSHOT"
depends_on:
- "server"
environment:
- JAVA_OPTS=-Dspring.profiles.active="default" -Dspring.config.additional-location="file:/config/"
volumes:
- /tmp:/tmp
- /mnt:/mnt:ro
- <local file path for external config file>:/config
- ./log-openapi-client:/logs
network_mode: bridge
In the local config file named application.yml you have to override "localhost" with the concrete machine ip address, e.g.
feign:
url: 192.168.168.1:5000
http://localhost:5000/swagger-ui
http://localhost:5000/api
http://localhost:5000/api.yaml