From 61c0216a3ecb659c96e50776bd9debc23f6423e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beatrice=20Dellac=C3=A0?= Date: Tue, 6 Aug 2024 21:48:15 +0200 Subject: [PATCH] RHSRV-1 - implement basic spring boot --- pom.xml | 5 +++++ src/main/java/wtf/beatrice/releasehive/Main.java | 6 ++++++ .../wtf/beatrice/releasehive/TryController.java | 13 +++++++++++++ 3 files changed, 24 insertions(+) create mode 100644 src/main/java/wtf/beatrice/releasehive/TryController.java diff --git a/pom.xml b/pom.xml index a691364..9b8762b 100644 --- a/pom.xml +++ b/pom.xml @@ -19,6 +19,11 @@ log4j-core 2.23.1 + + org.springframework.boot + spring-boot-starter-web + 3.3.2 + diff --git a/src/main/java/wtf/beatrice/releasehive/Main.java b/src/main/java/wtf/beatrice/releasehive/Main.java index f5962ae..9fb3712 100644 --- a/src/main/java/wtf/beatrice/releasehive/Main.java +++ b/src/main/java/wtf/beatrice/releasehive/Main.java @@ -2,7 +2,10 @@ package wtf.beatrice.releasehive; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +@SpringBootApplication public class Main { private static final Logger LOGGER = LogManager.getLogger(Main.class); @@ -10,5 +13,8 @@ public class Main { public static void main(String[] args) { LOGGER.info("Hello world!"); + LOGGER.info("Initializing Spring Boot"); + SpringApplication.run(Main.class, args); + LOGGER.info("Spring Boot initialized!"); } } diff --git a/src/main/java/wtf/beatrice/releasehive/TryController.java b/src/main/java/wtf/beatrice/releasehive/TryController.java new file mode 100644 index 0000000..124e179 --- /dev/null +++ b/src/main/java/wtf/beatrice/releasehive/TryController.java @@ -0,0 +1,13 @@ +package wtf.beatrice.releasehive; + +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +public class TryController { + + @GetMapping("/try") + public String tryMethod() { + return "Hello World!"; + } +}