From 2788e1450c1e8824380496185e32877db64b7139 Mon Sep 17 00:00:00 2001 From: diegoitaliait Date: Fri, 20 Dec 2024 17:35:59 +0100 Subject: [PATCH] added java and gradle resources --- build.gradle | 22 ++++++++++++++ docker-compose.yml | 8 ++--- settings.gradle | 1 + .../it/pagopa/status/StatusApplication.java | 11 +++++++ .../status/controller/StatusController.java | 29 +++++++++++++++++++ src/main/resources/application.properties | 3 ++ 6 files changed, 70 insertions(+), 4 deletions(-) create mode 100644 build.gradle create mode 100644 settings.gradle create mode 100644 src/main/java/it/pagopa/status/StatusApplication.java create mode 100644 src/main/java/it/pagopa/status/controller/StatusController.java create mode 100644 src/main/resources/application.properties diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000..e610a69 --- /dev/null +++ b/build.gradle @@ -0,0 +1,22 @@ +plugins { + id 'org.springframework.boot' version '2.5.4' + id 'io.spring.dependency-management' version '1.0.11.RELEASE' + id 'java' +} + +group = 'it.pagopa.status' +version = '0.0.1-SNAPSHOT' +sourceCompatibility = '11' + +repositories { + mavenCentral() +} + +dependencies { + implementation 'org.springframework.boot:spring-boot-starter-web' + testImplementation 'org.springframework.boot:spring-boot-starter-test' +} + +test { + useJUnitPlatform() +} \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 000b07f..8506d15 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,10 +1,10 @@ version: "3.8" services: - status: + status-service: build: - dockerfile: ./Dockerfile context: . - container_name: status + dockerfile: Dockerfile + container_name: status-service restart: always ports: - - "8000:8000" + - "8000:8080" \ No newline at end of file diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 0000000..1a55055 --- /dev/null +++ b/settings.gradle @@ -0,0 +1 @@ +rootProject.name = 'status-service' \ No newline at end of file diff --git a/src/main/java/it/pagopa/status/StatusApplication.java b/src/main/java/it/pagopa/status/StatusApplication.java new file mode 100644 index 0000000..b91dbb5 --- /dev/null +++ b/src/main/java/it/pagopa/status/StatusApplication.java @@ -0,0 +1,11 @@ +package it.pagopa.status; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class StatusApplication { + public static void main(String[] args) { + SpringApplication.run(StatusApplication.class, args); + } +} \ No newline at end of file diff --git a/src/main/java/it/pagopa/status/controller/StatusController.java b/src/main/java/it/pagopa/status/controller/StatusController.java new file mode 100644 index 0000000..bc3d9f1 --- /dev/null +++ b/src/main/java/it/pagopa/status/controller/StatusController.java @@ -0,0 +1,29 @@ +package it.pagopa.status.controller; + +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +public class StatusController { + + @GetMapping("/") + public ResponseEntity home() { + return ResponseEntity.ok().build(); + } + + @GetMapping("/status") + public ResponseEntity status() { + return ResponseEntity.ok().build(); + } + + @GetMapping("/health") + public ResponseEntity health() { + return ResponseEntity.ok().build(); + } + + @GetMapping("/healthz") + public ResponseEntity healthz() { + return ResponseEntity.ok().build(); + } +} \ No newline at end of file diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties new file mode 100644 index 0000000..2fd3f07 --- /dev/null +++ b/src/main/resources/application.properties @@ -0,0 +1,3 @@ +server.port=8000 +spring.application.name=status-service +spring.main.banner-mode=off \ No newline at end of file