From 2bf1bffdf0c58be7b5cdf4a93a95d1f8eb256ec9 Mon Sep 17 00:00:00 2001 From: Rasmus Neikes Date: Sun, 18 Aug 2024 20:19:02 +0200 Subject: [PATCH] setup rest interface --- pom.xml | 318 ++++++++++-------- .../java/com/stktrk/app/AppApplication.java | 17 +- src/main/resources/application.properties | 1 + 3 files changed, 185 insertions(+), 151 deletions(-) diff --git a/pom.xml b/pom.xml index 7563ff4..5a3c889 100644 --- a/pom.xml +++ b/pom.xml @@ -1,155 +1,175 @@ - 4.0.0 - - org.springframework.boot - spring-boot-starter-parent - 3.4.0-SNAPSHOT - - - com.stktrk - app - 0.0.1-SNAPSHOT - app - stktrk backend - - - - - - - - - - - - - - - 21 - - - - org.springframework.boot - spring-boot-starter-actuator - - - org.springframework.boot - spring-boot-starter-amqp - - - org.springframework.boot - spring-boot-starter-jooq - - - org.springframework.boot - spring-boot-starter-web - - - org.flywaydb - flyway-core - - - org.springframework.session - spring-session-core - + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> + 4.0.0 + + org.springframework.boot + spring-boot-starter-parent + 3.4.0-SNAPSHOT + + + com.stktrk + app + 0.0.1-SNAPSHOT + app + stktrk backend + + + + + + + + + + + + + + + 21 + + + + org.springframework.boot + spring-boot-starter-actuator + + + org.springframework.boot + spring-boot-starter-amqp + + + org.springframework.boot + spring-boot-starter-jooq + + + org.springframework.boot + spring-boot-starter-web + + + org.flywaydb + flyway-core + + + org.springframework.session + spring-session-core + - - org.springframework.boot - spring-boot-devtools - runtime - true - - - org.springframework.boot - spring-boot-docker-compose - runtime - true - - - org.projectlombok - lombok - true - - - org.springframework.boot - spring-boot-starter-test - test - - - org.springframework.boot - spring-boot-testcontainers - test - - - org.springframework.amqp - spring-rabbit-test - test - - - org.testcontainers - junit-jupiter - test - - - org.testcontainers - rabbitmq - test - - + + org.springframework.boot + spring-boot-devtools + runtime + true + + + org.springframework.boot + spring-boot-docker-compose + runtime + true + + + org.projectlombok + lombok + true + + + org.springframework.boot + spring-boot-starter-test + test + + + org.springframework.boot + spring-boot-testcontainers + test + + + org.springframework.amqp + spring-rabbit-test + test + + + org.testcontainers + junit-jupiter + test + + + org.testcontainers + rabbitmq + test + + + com.arcadedb + arcadedb-gremlin + 24.6.1 + + + com.arcadedb + arcadedb-server + 24.6.1 + + + org.hashids + hashids + 1.0.3 + + + javax.annotation + javax.annotation-api + 1.3.2 + + - - - - org.springframework.boot - spring-boot-maven-plugin - - - - org.projectlombok - lombok - - - - - - - - - spring-milestones - Spring Milestones - https://repo.spring.io/milestone - - false - - - - spring-snapshots - Spring Snapshots - https://repo.spring.io/snapshot - - false - - - - - - spring-milestones - Spring Milestones - https://repo.spring.io/milestone - - false - - - - spring-snapshots - Spring Snapshots - https://repo.spring.io/snapshot - - false - - - + + + + org.springframework.boot + spring-boot-maven-plugin + + + + org.projectlombok + lombok + + + + + + + + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + false + + + + spring-snapshots + Spring Snapshots + https://repo.spring.io/snapshot + + false + + + + + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + false + + + + spring-snapshots + Spring Snapshots + https://repo.spring.io/snapshot + + false + + + diff --git a/src/main/java/com/stktrk/app/AppApplication.java b/src/main/java/com/stktrk/app/AppApplication.java index e06d087..d0968f2 100644 --- a/src/main/java/com/stktrk/app/AppApplication.java +++ b/src/main/java/com/stktrk/app/AppApplication.java @@ -2,12 +2,25 @@ package com.stktrk.app; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; +import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; -@SpringBootApplication -public class AppApplication { +// https://stackoverflow.com/questions/51221777/failed-to-configure-a-datasource-url-attribute-is-not-specified-and-no-embedd +@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class }) +@RestController +public class AppApplication extends SpringBootServletInitializer { public static void main(String[] args) { SpringApplication.run(AppApplication.class, args); } + @GetMapping("/hello") + public String sayHello(@RequestParam(value = "myName", defaultValue = "World") String name) { + return String.format("Hello %s!", name); + } + } diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 1e6ca6c..6bc9859 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1 +1,2 @@ spring.application.name=app +server.port=9090 \ No newline at end of file