Component | Implementation | Standard |
---|---|---|
Dependency Injection | Weld | Contexts and Dependency Injection (CDI) |
Web Services | Jersey | Jakarta RESTful Web Services (JAX-RS) |
Configuration | SmallRye Config | Eclipse MicroProfile OpenAPI |
mvn package cargo:run
mvn package cargo:run -Dcargo.maven.containerId=jetty12x
This will add -Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=y
.
mvn package cargo:run -Dcargo.debug=true
mvn package cargo:run -Dcargo.maven.containerId=jetty12x -Dcargo.debug=true
mvn verify
mvn verify -Dcargo.maven.containerId=jetty12x
- Select
Window > Show View > Other...
- Choose
Server > Servers
- Select
No servers are available. Click this link to create a new server...
- Choose
Apache > Tomcat v10.1 Server
- Select
Download and Install...
- Choose
Folder
to install - Select
Next
- Add
elide-war-example
- Select
Finish
The application uses SmallRye Config for YAML configuration. The configuration file can be found in src/main/resources/META-INF/microprofile-config.yaml
.
The application uses Hibernate Validator for Bean Validation. This also uses Hibernate Validator CDI which exposes a jakarta.validation.ValidatorFactory
which is configured on Hibernate with the setting AvailableSettings.JAKARTA_VALIDATION_FACTORY
. This allows the use of @Inject
in jakarta.validation.ConstraintValidator
implementations.
- URL:
POST
http://localhost:8080/api/graphql
- Content-Type:
application/json
- Accept:
application/json
mutation UpsertGroup {
group(op: UPSERT, data: {groupId: "com.yahoo.elide", description: "Elide"}) {
edges {
node {
groupId
description
products(
op: UPSERT
data: {productId: "elide-core", description: "Elide Core", name: "Elide Core"}
) {
edges {
node {
productId
description
name
versions(op: UPSERT, data: {version: "7.0.0"}) {
edges {
node {
versionId
version
createdOn
}
}
}
}
}
}
}
}
}
}
- URL:
POST
http://localhost:8080/api/graphql
- Content-Type:
application/json
- Accept:
application/json
query QueryGroup {
group {
edges {
node {
groupId
description
products {
edges {
node {
productId
description
name
versions {
edges {
node {
versionId
version
createdOn
}
}
}
}
}
}
}
}
}
}
- URL:
ws://localhost:8080/subscription
subscription {
group(topic: ADDED) {
groupId
description
}
}
- URL:
POST
http://localhost:8080/api/operations
- Content-Type:
application/vnd.api+json; ext="https://jsonapi.org/ext/atomic"
- Accept:
application/vnd.api+json; ext="https://jsonapi.org/ext/atomic"
{
"atomic:operations": [
{
"op": "add",
"data": {
"type": "group",
"id": "io.swagger.core.v3",
"attributes": {
"description": "Swagger"
}
}
},
{
"op": "add",
"href": "/group/io.swagger.core.v3/products",
"data": {
"type": "product",
"id": "swagger-core",
"attributes": {
"description": "Swagger Core"
}
}
},
{
"op": "add",
"href": "/group/io.swagger.core.v3/products/swagger-core/versions",
"data": {
"type": "version",
"lid": "dfb0e20c-cea9-4233-9e7d-32ba15596bdf",
"attributes": {
"version": "2.2.15"
}
}
},
{
"op": "add",
"href": "/group/io.swagger.core.v3/products/swagger-core/versions",
"data": {
"type": "version",
"lid": "b6fce0b4-2034-4146-a6a6-d6e7777165b3",
"attributes": {
"version": "2.1.13"
}
}
}
]
}
- URL:
GET
http://localhost:8080/api/group?include=products,products.versions
- Accept:
application/vnd.api+json
- URL:
POST
http://localhost:8080/api/operations
- Content-Type:
application/vnd.api+json; ext="https://jsonapi.org/ext/atomic"
- Accept:
application/vnd.api+json; ext="https://jsonapi.org/ext/atomic"
{
"atomic:operations": [
{
"op": "remove",
"href": "/group/io.swagger.core.v3/products/swagger-core"
},
{
"op": "remove",
"ref": {
"type": "group",
"id": "io.swagger.core.v3"
}
}
]
}
-
Build the image
docker build -t elide/elide-war-example .
-
Run the container
docker run -p 80:8080 -d elide/elide-war-example
-
The application should be running on port 80
http://localhost/
To build:
mvn clean package
The war should be deployed to CATALINA_HOME/webapps
.
The JETTY_BASE
needs to be set up with the following with the war deployed at JETTY_BASE/webapp
.
cd $JETTY_BASE
java -jar $JETTY_HOME/start.jar --add-modules=http,ee10-deploy,ee10-annotations,ee10-websocket-jakarta,ee10-cdi-decorate
Currently Jetty 12 requires a custom ServletContainerInitializer
to explicitly set the CDI Provider to the WeldProvider
due to the following issue jetty/jetty.project#10150 as the presence of the jakarta.enterprise.cdi-api library in the Jetty classpath causes the ServiceLoader not to find the WeldProvider. This is implemented in WeldServletContainerInitializer
.
The JETTY_BASE
needs to be set up with the following with the war deployed at JETTY_BASE/webapp
.
cd $JETTY_BASE
java -jar $JETTY_HOME/start.jar --add-modules=http,deploy,annotations,websocket-jakarta,cdi-decorate
cd $CATALINA_HOME
catalina start
The server can be started with the following.
cd $JETTY_BASE
java -jar $JETTY_HOME/start.jar
The server can be started with the following.
cd $JETTY_BASE
java -jar $JETTY_HOME/start.jar