mvn archetype:generate -DarchetypeGroupId=io.dropwizard.archetypes \
-DarchetypeArtifactId=java-simple \
-DarchetypeVersion=1.2.2
Define value for property 'groupId': : org.mohansun.dev
Define value for property 'artifactId': : DWTestApp
Define value for property 'version': 1.0-SNAPSHOT: :
Define value for property 'package': org.mohansun.dev: :
[INFO] Using property: description = null
Define value for property 'name': : DWTestApp
[INFO] Using property: shaded = true
Confirm properties configuration:
groupId: org.mohansun.dev
artifactId: DWTestApp
version: 1.0-SNAPSHOT
package: org.mohansun.dev
description: null
name: DWTestApp
shaded: true
$ cat DWTestApp.yml
template: Hello, %s!, Welcome!
defaultName: Ken
server:
rootPath: /api/*
- Run:
mvn clean install
to build your application
- Check the application :
java -jar target/DWTestApp-1.0-SNAPSHOT.jar check DWTestApp.yml
INFO [2018-03-09 19:12:20,177] io.dropwizard.cli.CheckCommand: Configuration is OK
- Start application with:
java -jar target/DWTestApp-1.0-SNAPSHOT.jar server DWTestApp.yml
- To check that your application is running:
enter url :
http://localhost:8080/api/hello-world
// http://localhost:8080/api/hello-world
{
"id": 1,
"content": "Hello, Ken!, Welcome!"
}
$ curl http://localhost:8080/api/events | jq
[
{
"id": 1,
"name": "Birthday",
"description": "Please be on time!",
"location": "221B Baker Street",
"date": 1520637966499
}
]
To see your applications health enter url http://localhost:8081/healthcheck
// http://localhost:8081/healthcheck
{
"deadlocks": {
"healthy": true
},
"template": {
"healthy": true
}
}