Sunday, July 30, 2023

[java] [maven] [dropwizard] DropWizard HelloWorld API from scratch



[0] Preparation.

[1] Make project directory

[2] Create pom file

[3] Create source directory

[4] Complete the pom file

The full pom file would be as follows:

[5] Add Dropwizard files

  • Configuration Class File
  • Application Class File
  • Representation Class File
  • Resource Class File
  • Health Check Class File (optional)
  • Config File

[5.1] Configuration

Location:src\main\java\com\mycompany\helloworld\HelloWorldConfiguration.java

[5.2] Application

Location:src\main\java\com\mycompany\helloworld\HelloWorldApplication.java

[5.3] Representation

Location:src\main\java\com\mycompany\helloworld\api\HelloWorld.java

[5.4] Resource

Location:src\main\java\com\mycompany\helloworld\resources\HelloWorldResource.java

[5.5] HealthCheck

Location:src\main\java\com\mycompany\helloworld\health\HelloWorldResource.java

[5.6] Config

Location:config.yml

[6] Compile and run

No comments:

Post a Comment