From 43d4320728d5dcc4254284b183a431d88cd97396 Mon Sep 17 00:00:00 2001 From: hirst Date: Fri, 24 May 2024 15:05:58 +0200 Subject: [PATCH 1/9] added openjdk 22.0.1 as the build version --- .idea/.gitignore | 8 ++++++++ .idea/compiler.xml | 22 ++++++++++++++++++++++ .idea/encodings.xml | 8 ++++++++ .idea/jarRepositories.xml | 20 ++++++++++++++++++++ .idea/misc.xml | 16 ++++++++++++++++ .idea/modules.xml | 8 ++++++++ .idea/server.iml | 9 +++++++++ .idea/vcs.xml | 6 ++++++ 8 files changed, 97 insertions(+) create mode 100644 .idea/.gitignore create mode 100644 .idea/compiler.xml create mode 100644 .idea/encodings.xml create mode 100644 .idea/jarRepositories.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/server.iml create mode 100644 .idea/vcs.xml diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..271397a --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 0000000..4d92f14 --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml new file mode 100644 index 0000000..712ab9d --- /dev/null +++ b/.idea/jarRepositories.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..42b8d99 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,16 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..fbd90b4 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/server.iml b/.idea/server.iml new file mode 100644 index 0000000..d6ebd48 --- /dev/null +++ b/.idea/server.iml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file From 45f52ab941c017fa833eb8957321def41c1cc05a Mon Sep 17 00:00:00 2001 From: hirst Date: Fri, 24 May 2024 20:17:11 +0200 Subject: [PATCH 2/9] started adding GatewayApplication.java stuff UNFINISHED currently waiting for approval to change core dependencies cus they're incompatible also renamed it to "Eureka" cus thats how its called --- .idea/compiler.xml | 4 +- .idea/encodings.xml | 2 +- .idea/misc.xml | 1 + .idea/uiDesigner.xml | 124 ++++++++++++++++++ {eurika => eureka}/.gitignore | 0 .../.mvn/wrapper/maven-wrapper.properties | 0 {eurika => eureka}/mvnw | 0 {eurika => eureka}/mvnw.cmd | 0 {eurika => eureka}/pom.xml | 7 +- .../eurika/EurekaApplication.java | 6 +- .../src/main/resources/application.properties | 10 ++ .../eurika/EurekaApplicationTests.java | 2 +- .../src/main/resources/application.properties | 1 - gateway/pom.xml | 14 ++ .../gateway/GatewayApplication.java | 4 +- .../learningpulse/gateway/SimpleGateway.java | 14 ++ .../gateway/config/Appconfig.java | 15 +++ .../src/main/resources/application.properties | 24 ++++ 18 files changed, 218 insertions(+), 10 deletions(-) create mode 100644 .idea/uiDesigner.xml rename {eurika => eureka}/.gitignore (100%) rename {eurika => eureka}/.mvn/wrapper/maven-wrapper.properties (100%) rename {eurika => eureka}/mvnw (100%) mode change 100755 => 100644 rename {eurika => eureka}/mvnw.cmd (100%) rename {eurika => eureka}/pom.xml (88%) rename eurika/src/main/java/com/learningpulse/eurika/EurikaApplication.java => eureka/src/main/java/com/learningpulse/eurika/EurekaApplication.java (55%) create mode 100644 eureka/src/main/resources/application.properties rename eurika/src/test/java/com/learningpulse/eurika/EurikaApplicationTests.java => eureka/src/test/java/com/learningpulse/eurika/EurekaApplicationTests.java (85%) delete mode 100644 eurika/src/main/resources/application.properties create mode 100644 gateway/src/main/java/com/learningpulse/gateway/SimpleGateway.java create mode 100644 gateway/src/main/java/com/learningpulse/gateway/config/Appconfig.java diff --git a/.idea/compiler.xml b/.idea/compiler.xml index 271397a..b38cbb0 100644 --- a/.idea/compiler.xml +++ b/.idea/compiler.xml @@ -7,15 +7,15 @@ - + diff --git a/.idea/encodings.xml b/.idea/encodings.xml index 4d92f14..ce1fbb5 100644 --- a/.idea/encodings.xml +++ b/.idea/encodings.xml @@ -2,7 +2,7 @@ - + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index 42b8d99..edd914b 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -7,6 +7,7 @@ diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml new file mode 100644 index 0000000..2b63946 --- /dev/null +++ b/.idea/uiDesigner.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/eurika/.gitignore b/eureka/.gitignore similarity index 100% rename from eurika/.gitignore rename to eureka/.gitignore diff --git a/eurika/.mvn/wrapper/maven-wrapper.properties b/eureka/.mvn/wrapper/maven-wrapper.properties similarity index 100% rename from eurika/.mvn/wrapper/maven-wrapper.properties rename to eureka/.mvn/wrapper/maven-wrapper.properties diff --git a/eurika/mvnw b/eureka/mvnw old mode 100755 new mode 100644 similarity index 100% rename from eurika/mvnw rename to eureka/mvnw diff --git a/eurika/mvnw.cmd b/eureka/mvnw.cmd similarity index 100% rename from eurika/mvnw.cmd rename to eureka/mvnw.cmd diff --git a/eurika/pom.xml b/eureka/pom.xml similarity index 88% rename from eurika/pom.xml rename to eureka/pom.xml index 763bba1..4be19e3 100644 --- a/eurika/pom.xml +++ b/eureka/pom.xml @@ -9,20 +9,23 @@ com.learningpulse - eurika + eureka 0.0.1-SNAPSHOT - eurika + eureka Demo project for Spring Boot 22 2023.0.1 + org.springframework.cloud spring-cloud-starter-netflix-eureka-server + 4.1.1 + org.springframework.boot spring-boot-starter-test diff --git a/eurika/src/main/java/com/learningpulse/eurika/EurikaApplication.java b/eureka/src/main/java/com/learningpulse/eurika/EurekaApplication.java similarity index 55% rename from eurika/src/main/java/com/learningpulse/eurika/EurikaApplication.java rename to eureka/src/main/java/com/learningpulse/eurika/EurekaApplication.java index 2c9a7b4..17c4ad9 100644 --- a/eurika/src/main/java/com/learningpulse/eurika/EurikaApplication.java +++ b/eureka/src/main/java/com/learningpulse/eurika/EurekaApplication.java @@ -2,12 +2,14 @@ package com.learningpulse.eurika; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer; +@EnableEurekaServer @SpringBootApplication -public class EurikaApplication { +public class EurekaApplication { public static void main(String[] args) { - SpringApplication.run(EurikaApplication.class, args); + SpringApplication.run(EurekaApplication.class, args); } } diff --git a/eureka/src/main/resources/application.properties b/eureka/src/main/resources/application.properties new file mode 100644 index 0000000..bb67d3e --- /dev/null +++ b/eureka/src/main/resources/application.properties @@ -0,0 +1,10 @@ +spring.application.name=eureka + +server.port=8761 + +spring.security.user.name=admin +spring.security.user.password=admin + +eureka.instance.hostname=localhost +eureka.client.register-with-eureka=false +eureka.client.fetch-registry=false \ No newline at end of file diff --git a/eurika/src/test/java/com/learningpulse/eurika/EurikaApplicationTests.java b/eureka/src/test/java/com/learningpulse/eurika/EurekaApplicationTests.java similarity index 85% rename from eurika/src/test/java/com/learningpulse/eurika/EurikaApplicationTests.java rename to eureka/src/test/java/com/learningpulse/eurika/EurekaApplicationTests.java index 78314ba..f97e926 100644 --- a/eurika/src/test/java/com/learningpulse/eurika/EurikaApplicationTests.java +++ b/eureka/src/test/java/com/learningpulse/eurika/EurekaApplicationTests.java @@ -4,7 +4,7 @@ import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; @SpringBootTest -class EurikaApplicationTests { +class EurekaApplicationTests { @Test void contextLoads() { diff --git a/eurika/src/main/resources/application.properties b/eurika/src/main/resources/application.properties deleted file mode 100644 index 2eb1f79..0000000 --- a/eurika/src/main/resources/application.properties +++ /dev/null @@ -1 +0,0 @@ -spring.application.name=eurika diff --git a/gateway/pom.xml b/gateway/pom.xml index fde2962..89ecf18 100644 --- a/gateway/pom.xml +++ b/gateway/pom.xml @@ -17,6 +17,10 @@ 22 2023.0.1 + org.springframework.boot @@ -36,6 +40,7 @@ lombok true + org.springframework.boot spring-boot-starter-test @@ -46,6 +51,15 @@ spring-restdocs-mockmvc test + + org.springframework.boot + spring-boot-starter-security + + + org.springdoc + springdoc-openapi-starter-webmvc-ui + 2.2.0 + diff --git a/gateway/src/main/java/com/learningpulse/gateway/GatewayApplication.java b/gateway/src/main/java/com/learningpulse/gateway/GatewayApplication.java index f4cdf2f..511cf50 100644 --- a/gateway/src/main/java/com/learningpulse/gateway/GatewayApplication.java +++ b/gateway/src/main/java/com/learningpulse/gateway/GatewayApplication.java @@ -2,12 +2,14 @@ package com.learningpulse.gateway; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cloud.client.discovery.EnableDiscoveryClient; + +@EnableDiscoveryClient @SpringBootApplication public class GatewayApplication { public static void main(String[] args) { SpringApplication.run(GatewayApplication.class, args); } - } diff --git a/gateway/src/main/java/com/learningpulse/gateway/SimpleGateway.java b/gateway/src/main/java/com/learningpulse/gateway/SimpleGateway.java new file mode 100644 index 0000000..c68fc03 --- /dev/null +++ b/gateway/src/main/java/com/learningpulse/gateway/SimpleGateway.java @@ -0,0 +1,14 @@ +package com.learningpulse.gateway; +import org.springframework.context.annotation.Bean; +import org.springframework.web.servlet.function.RouterFunction; +import org.springframework.web.servlet.function.ServerResponse; + +import static org.springframework.web.servlet.function.RouterFunctions.route; +import static org.springframework.cloud.gateway.server.mvc.handler.HandlerFunctions.http; + +public class SimpleGateway { + @Bean + public RouterFunction getRoute() { + return route().GET("/get", http("https://httpbin.org")).build(); + } +} diff --git a/gateway/src/main/java/com/learningpulse/gateway/config/Appconfig.java b/gateway/src/main/java/com/learningpulse/gateway/config/Appconfig.java new file mode 100644 index 0000000..04ba084 --- /dev/null +++ b/gateway/src/main/java/com/learningpulse/gateway/config/Appconfig.java @@ -0,0 +1,15 @@ +package com.learningpulse.gateway.config; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.servlet.function.RouterFunction; +import org.springframework.web.servlet.function.ServerResponse; + +import org.springframework.web.servlet.function.RouterFunctions; + + +// TODO copy lambda code lol +@Configuration(proxyBeanMethods = false) +public class Appconfig { + +} diff --git a/gateway/src/main/resources/application.properties b/gateway/src/main/resources/application.properties index 6365994..811acbf 100644 --- a/gateway/src/main/resources/application.properties +++ b/gateway/src/main/resources/application.properties @@ -1 +1,25 @@ spring.application.name=gateway +app.eureka-server=localhost + +eureka.client.service-url.defaultZone=http://localhost:8761/eureka +server.port=8181 +server.servlet.context-path=/ + +spring.cloud.discovery.enabled=true + +# TODO change these back to lambda's stuffs +spring.cloud.gateway.mvc.routes[0].id=discovery-server +spring.cloud.gateway.mvc.routes[0].uri=http://${app.eureka-server}:8761 +spring.cloud.gateway.mvc.routes[0].predicates[0]=Path=/eureka/web +spring.cloud.gateway.mvc.routes[0].filters[0]=SetPath=/ + +springdoc.enable-javadoc=true +springdoc.api-docs.enabled=true +springdoc.api-docs.groups.enabled=true +springdoc.swagger-ui.enabled=true +springdoc.swagger-ui.path=/swagger-ui.html +springdoc.swagger-ui.config-url=/v3/api-docs/swagger-config + + +springdoc.swagger-ui.urls[0].name=Api Gateway APIs +springdoc.swagger-ui.urls[0].url=/v3/api-docs \ No newline at end of file From 8e3bba298f834f054f7612e238f0b648ae54c434 Mon Sep 17 00:00:00 2001 From: hirst Date: Mon, 27 May 2024 15:57:18 +0200 Subject: [PATCH 3/9] updated application.properties to application.yml --- .../src/main/resources/application-docker.yml | 2 + .../src/main/resources/application.properties | 1 - dummy/src/main/resources/application.yml | 36 +++++++++ .../src/main/resources/application.properties | 10 --- eureka/src/main/resources/application.yml | 18 +++++ .../src/main/resources/application-docker.yml | 2 + .../src/main/resources/application.properties | 25 ------ gateway/src/main/resources/application.yml | 81 +++++++++++++++++++ 8 files changed, 139 insertions(+), 36 deletions(-) create mode 100644 dummy/src/main/resources/application-docker.yml delete mode 100644 dummy/src/main/resources/application.properties create mode 100644 dummy/src/main/resources/application.yml delete mode 100644 eureka/src/main/resources/application.properties create mode 100644 eureka/src/main/resources/application.yml create mode 100644 gateway/src/main/resources/application-docker.yml delete mode 100644 gateway/src/main/resources/application.properties create mode 100644 gateway/src/main/resources/application.yml diff --git a/dummy/src/main/resources/application-docker.yml b/dummy/src/main/resources/application-docker.yml new file mode 100644 index 0000000..a1d77c1 --- /dev/null +++ b/dummy/src/main/resources/application-docker.yml @@ -0,0 +1,2 @@ +app: + eureka-server: eureka \ No newline at end of file diff --git a/dummy/src/main/resources/application.properties b/dummy/src/main/resources/application.properties deleted file mode 100644 index 1f1e339..0000000 --- a/dummy/src/main/resources/application.properties +++ /dev/null @@ -1 +0,0 @@ -spring.application.name=dummy diff --git a/dummy/src/main/resources/application.yml b/dummy/src/main/resources/application.yml new file mode 100644 index 0000000..a50a127 --- /dev/null +++ b/dummy/src/main/resources/application.yml @@ -0,0 +1,36 @@ +app: + eureka-server: localhost + +server: + port: 0 + +spring: + application: + name: dummy + + # TODO remove after testing + security: + user: + name: admin + password: admin + +springdoc: + enable-native-support: true + api-docs: + enabled: true + path: /api/v1/dummy/v3/api-docs + swagger-ui: + path: /api/v1/dummy/swagger-ui.html + +management: + endpoints: + web: + exposure: + include: "*" + +eureka: + client: + service-url: + defaultZone: http://localhost:8761/eureka + # Will only work when docker is used + # defaultZone: http://${app.eureka-server}:8761/eureka diff --git a/eureka/src/main/resources/application.properties b/eureka/src/main/resources/application.properties deleted file mode 100644 index bb67d3e..0000000 --- a/eureka/src/main/resources/application.properties +++ /dev/null @@ -1,10 +0,0 @@ -spring.application.name=eureka - -server.port=8761 - -spring.security.user.name=admin -spring.security.user.password=admin - -eureka.instance.hostname=localhost -eureka.client.register-with-eureka=false -eureka.client.fetch-registry=false \ No newline at end of file diff --git a/eureka/src/main/resources/application.yml b/eureka/src/main/resources/application.yml new file mode 100644 index 0000000..d0a78e1 --- /dev/null +++ b/eureka/src/main/resources/application.yml @@ -0,0 +1,18 @@ +server: + port: 8761 + +eureka: + client: + register-with-eureka: false + fetch-registry: false + instance: + hostname: localhost + +spring: + application: + name: eureka + security: + # TODO remove after testing + user: + name: admin + password: admin \ No newline at end of file diff --git a/gateway/src/main/resources/application-docker.yml b/gateway/src/main/resources/application-docker.yml new file mode 100644 index 0000000..a1d77c1 --- /dev/null +++ b/gateway/src/main/resources/application-docker.yml @@ -0,0 +1,2 @@ +app: + eureka-server: eureka \ No newline at end of file diff --git a/gateway/src/main/resources/application.properties b/gateway/src/main/resources/application.properties deleted file mode 100644 index 811acbf..0000000 --- a/gateway/src/main/resources/application.properties +++ /dev/null @@ -1,25 +0,0 @@ -spring.application.name=gateway -app.eureka-server=localhost - -eureka.client.service-url.defaultZone=http://localhost:8761/eureka -server.port=8181 -server.servlet.context-path=/ - -spring.cloud.discovery.enabled=true - -# TODO change these back to lambda's stuffs -spring.cloud.gateway.mvc.routes[0].id=discovery-server -spring.cloud.gateway.mvc.routes[0].uri=http://${app.eureka-server}:8761 -spring.cloud.gateway.mvc.routes[0].predicates[0]=Path=/eureka/web -spring.cloud.gateway.mvc.routes[0].filters[0]=SetPath=/ - -springdoc.enable-javadoc=true -springdoc.api-docs.enabled=true -springdoc.api-docs.groups.enabled=true -springdoc.swagger-ui.enabled=true -springdoc.swagger-ui.path=/swagger-ui.html -springdoc.swagger-ui.config-url=/v3/api-docs/swagger-config - - -springdoc.swagger-ui.urls[0].name=Api Gateway APIs -springdoc.swagger-ui.urls[0].url=/v3/api-docs \ No newline at end of file diff --git a/gateway/src/main/resources/application.yml b/gateway/src/main/resources/application.yml new file mode 100644 index 0000000..9b2ea0b --- /dev/null +++ b/gateway/src/main/resources/application.yml @@ -0,0 +1,81 @@ +server: + port: 8181 + +spring: + application: + name: gateway + + cloud: + gateway: + discovery: + locator: + enabled: true + routes: + # eureka service routing + - id: eureka + # Will only work when docker is used + # uri: http://${app.eureka-server}:8761 + uri: http://localhost:8761 + predicates: + - Path=/eureka/web + filters: + - SetPath=/ + - id: eureka-static + # Will only work when docker is used + # uri: http://${app.eureka-server}:8761 + uri: http://localhost:8761 + predicates: + - Path=/eureka/** + # dummy service routing + # TODO smth is wrong with this + - id: dummy + uri: lb://dummy + predicates: + - Path=/api/v1/dummy/** + filters: + - AddResponseHeader=X-Powered-By, LearningPulse Gateway Service + security: + user: + name: admin + password: admin + + +# Keycloak configuration for the future +# security: +# oauth2: +# resourceserver: +# jwt: +# issuer-uri: ${KEYCLOAK_URL}/realms/LearningPulse +management: + endpoints: + web: + exposure: + include: "*" + endpoint: + health: + show-details: always + gateway: + enabled: true + +springdoc: + enable-native-support: true + api-docs: + enabled: true + groups: + enabled: true + swagger-ui: + path: /swagger-ui.html + config-url: /v3/api-docs/swagger-config + urls: + - name: Gateway API + url: /v3/api-docs + # TODO not working rn + - name: Dummy Service API + url: /api/v1/dummy/v3/api-docs + +eureka: + client: + service-url: + defaultZone: http://localhost:8761/eureka + # Will only work when docker is used + # defaultZone: http://${app.eureka-server}:8761/eureka From c02b24e76622f9103cdd38fc17e3520d15020ce0 Mon Sep 17 00:00:00 2001 From: hirst Date: Mon, 27 May 2024 15:58:42 +0200 Subject: [PATCH 4/9] gateway actually works --- .../learningpulse/gateway/GatewayApplication.java | 5 +++-- .../com/learningpulse/gateway/SimpleGateway.java | 14 -------------- 2 files changed, 3 insertions(+), 16 deletions(-) delete mode 100644 gateway/src/main/java/com/learningpulse/gateway/SimpleGateway.java diff --git a/gateway/src/main/java/com/learningpulse/gateway/GatewayApplication.java b/gateway/src/main/java/com/learningpulse/gateway/GatewayApplication.java index 511cf50..bb4e61d 100644 --- a/gateway/src/main/java/com/learningpulse/gateway/GatewayApplication.java +++ b/gateway/src/main/java/com/learningpulse/gateway/GatewayApplication.java @@ -3,10 +3,11 @@ package com.learningpulse.gateway; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.client.discovery.EnableDiscoveryClient; +import org.springframework.security.config.annotation.web.reactive.EnableWebFluxSecurity; - -@EnableDiscoveryClient @SpringBootApplication +@EnableWebFluxSecurity +@EnableDiscoveryClient public class GatewayApplication { public static void main(String[] args) { diff --git a/gateway/src/main/java/com/learningpulse/gateway/SimpleGateway.java b/gateway/src/main/java/com/learningpulse/gateway/SimpleGateway.java deleted file mode 100644 index c68fc03..0000000 --- a/gateway/src/main/java/com/learningpulse/gateway/SimpleGateway.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.learningpulse.gateway; -import org.springframework.context.annotation.Bean; -import org.springframework.web.servlet.function.RouterFunction; -import org.springframework.web.servlet.function.ServerResponse; - -import static org.springframework.web.servlet.function.RouterFunctions.route; -import static org.springframework.cloud.gateway.server.mvc.handler.HandlerFunctions.http; - -public class SimpleGateway { - @Bean - public RouterFunction getRoute() { - return route().GET("/get", http("https://httpbin.org")).build(); - } -} From a651681c674d887bf5575093147d2d03c0ce2d77 Mon Sep 17 00:00:00 2001 From: hirst Date: Mon, 27 May 2024 17:19:57 +0200 Subject: [PATCH 5/9] renamed eurika to eureka --- .../com/learningpulse/{eurika => eureka}/EurekaApplication.java | 2 +- .../{eurika => eureka}/EurekaApplicationTests.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename eureka/src/main/java/com/learningpulse/{eurika => eureka}/EurekaApplication.java (91%) rename eureka/src/test/java/com/learningpulse/{eurika => eureka}/EurekaApplicationTests.java (84%) diff --git a/eureka/src/main/java/com/learningpulse/eurika/EurekaApplication.java b/eureka/src/main/java/com/learningpulse/eureka/EurekaApplication.java similarity index 91% rename from eureka/src/main/java/com/learningpulse/eurika/EurekaApplication.java rename to eureka/src/main/java/com/learningpulse/eureka/EurekaApplication.java index 17c4ad9..d2c27e8 100644 --- a/eureka/src/main/java/com/learningpulse/eurika/EurekaApplication.java +++ b/eureka/src/main/java/com/learningpulse/eureka/EurekaApplication.java @@ -1,4 +1,4 @@ -package com.learningpulse.eurika; +package com.learningpulse.eureka; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; diff --git a/eureka/src/test/java/com/learningpulse/eurika/EurekaApplicationTests.java b/eureka/src/test/java/com/learningpulse/eureka/EurekaApplicationTests.java similarity index 84% rename from eureka/src/test/java/com/learningpulse/eurika/EurekaApplicationTests.java rename to eureka/src/test/java/com/learningpulse/eureka/EurekaApplicationTests.java index f97e926..ab78178 100644 --- a/eureka/src/test/java/com/learningpulse/eurika/EurekaApplicationTests.java +++ b/eureka/src/test/java/com/learningpulse/eureka/EurekaApplicationTests.java @@ -1,4 +1,4 @@ -package com.learningpulse.eurika; +package com.learningpulse.eureka; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; From 035eb6ffb2068e72ffc9b8e5426397cea42cdd5c Mon Sep 17 00:00:00 2001 From: hirst Date: Mon, 27 May 2024 17:21:08 +0200 Subject: [PATCH 6/9] added openAPI stuff --- .../gateway/config/Appconfig.java | 15 ----------- .../gateway/config/OpenAPIConfiguration.java | 25 +++++++++++++++++++ 2 files changed, 25 insertions(+), 15 deletions(-) delete mode 100644 gateway/src/main/java/com/learningpulse/gateway/config/Appconfig.java create mode 100644 gateway/src/main/java/com/learningpulse/gateway/config/OpenAPIConfiguration.java diff --git a/gateway/src/main/java/com/learningpulse/gateway/config/Appconfig.java b/gateway/src/main/java/com/learningpulse/gateway/config/Appconfig.java deleted file mode 100644 index 04ba084..0000000 --- a/gateway/src/main/java/com/learningpulse/gateway/config/Appconfig.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.learningpulse.gateway.config; - -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.web.servlet.function.RouterFunction; -import org.springframework.web.servlet.function.ServerResponse; - -import org.springframework.web.servlet.function.RouterFunctions; - - -// TODO copy lambda code lol -@Configuration(proxyBeanMethods = false) -public class Appconfig { - -} diff --git a/gateway/src/main/java/com/learningpulse/gateway/config/OpenAPIConfiguration.java b/gateway/src/main/java/com/learningpulse/gateway/config/OpenAPIConfiguration.java new file mode 100644 index 0000000..a623308 --- /dev/null +++ b/gateway/src/main/java/com/learningpulse/gateway/config/OpenAPIConfiguration.java @@ -0,0 +1,25 @@ +package com.learningpulse.gateway.config; + +import io.swagger.v3.oas.models.OpenAPI; +import io.swagger.v3.oas.models.info.Contact; +import io.swagger.v3.oas.models.info.Info; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.stereotype.Component; + + +@Component +@Configuration +public class OpenAPIConfiguration { + @Bean + public OpenAPI gatewayOpenAPI() { + return new OpenAPI().info(new Info() + .title("Learning Pulse API documentation") + .version("0.0.1") + .description("This is the API documentation for the Learning Pulse project.") + .contact(new Contact() + .name("Learning Pulse") + .url("https://git.4o1x5.dev/LearningPulse")) + ); + } +} From a36c9d778b91164b7175fcb8eec839fbf476e69a Mon Sep 17 00:00:00 2001 From: hirst Date: Mon, 27 May 2024 17:21:49 +0200 Subject: [PATCH 7/9] added dummy application --- .../learningpulse/dummy/DummyApplication.java | 3 +++ .../main/java/com/learningpulse/dummy/Test.java | 16 ++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 dummy/src/main/java/com/learningpulse/dummy/Test.java diff --git a/dummy/src/main/java/com/learningpulse/dummy/DummyApplication.java b/dummy/src/main/java/com/learningpulse/dummy/DummyApplication.java index 9f083f0..54e1e05 100644 --- a/dummy/src/main/java/com/learningpulse/dummy/DummyApplication.java +++ b/dummy/src/main/java/com/learningpulse/dummy/DummyApplication.java @@ -2,8 +2,11 @@ package com.learningpulse.dummy; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cloud.client.discovery.EnableDiscoveryClient; + @SpringBootApplication +@EnableDiscoveryClient public class DummyApplication { public static void main(String[] args) { diff --git a/dummy/src/main/java/com/learningpulse/dummy/Test.java b/dummy/src/main/java/com/learningpulse/dummy/Test.java new file mode 100644 index 0000000..7da105e --- /dev/null +++ b/dummy/src/main/java/com/learningpulse/dummy/Test.java @@ -0,0 +1,16 @@ +package com.learningpulse.dummy; + +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping("/api/v1/dummy") +public class Test { + + @GetMapping("/test") + public ResponseEntity test() { + return ResponseEntity.ok("Hello, World!"); + } +} From 31dcb2abf58ffd34ccfc492eacb9f2a860fad35f Mon Sep 17 00:00:00 2001 From: hirst Date: Mon, 27 May 2024 17:22:09 +0200 Subject: [PATCH 8/9] redone maven project files --- dummy/pom.xml | 79 ++++++++++++++++++++++++++--------------------- eureka/pom.xml | 42 ++++--------------------- gateway/pom.xml | 82 +++++++++++++------------------------------------ pom.xml | 81 ++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 153 insertions(+), 131 deletions(-) create mode 100644 pom.xml diff --git a/dummy/pom.xml b/dummy/pom.xml index 1ea50c3..071da9e 100644 --- a/dummy/pom.xml +++ b/dummy/pom.xml @@ -3,20 +3,56 @@ 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.2.5 - + com.learningpulse + server + 0.0.1 - com.learningpulse dummy - 0.0.1-SNAPSHOT + 0.0.1 dummy - Demo project for Spring Boot + A dummy project - 22 + + + org.springframework.boot + spring-boot-starter-web + + + + org.projectlombok + lombok + true + + + + org.springframework.cloud + spring-cloud-starter-netflix-eureka-client + + + + org.springframework.cloud + spring-cloud-config-server + + + org.springframework.boot + spring-boot-starter-oauth2-resource-server + + + + + org.springframework.security.oauth + spring-security-oauth2 + 2.5.2.RELEASE + + + + + org.springframework.security + spring-security-oauth2-resource-server + + org.springframework.boot spring-boot-starter-security @@ -27,16 +63,6 @@ postgresql runtime - - org.projectlombok - lombok - true - - - org.springframework.boot - spring-boot-starter-test - test - org.springframework.security spring-security-test @@ -44,21 +70,4 @@ - - - - org.springframework.boot - spring-boot-maven-plugin - - - - org.projectlombok - lombok - - - - - - - diff --git a/eureka/pom.xml b/eureka/pom.xml index 4be19e3..9369e60 100644 --- a/eureka/pom.xml +++ b/eureka/pom.xml @@ -3,20 +3,17 @@ 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.2.5 - + com.learningpulse + server + 0.0.1 - com.learningpulse eureka - 0.0.1-SNAPSHOT + 0.0.1 eureka - Demo project for Spring Boot + Eureka discovery server for LearningPulse - 22 - 2023.0.1 + @@ -24,33 +21,6 @@ spring-cloud-starter-netflix-eureka-server 4.1.1 - - - - org.springframework.boot - spring-boot-starter-test - test - - - - - org.springframework.cloud - spring-cloud-dependencies - ${spring-cloud.version} - pom - import - - - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - diff --git a/gateway/pom.xml b/gateway/pom.xml index 89ecf18..018a68c 100644 --- a/gateway/pom.xml +++ b/gateway/pom.xml @@ -3,75 +3,49 @@ 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.2.5 + com.learningpulse + server + 0.0.1 - com.learningpulse gateway - 0.0.1-SNAPSHOT + 0.0.1 gateway - Demo project for Spring Boot + API gateway for LearningPulse - 22 - 2023.0.1 - + - org.springframework.boot - spring-boot-starter-oauth2-resource-server + org.springframework.cloud + spring-cloud-starter-circuitbreaker-reactor-resilience4j org.springframework.cloud - spring-cloud-starter-gateway-mvc - - - org.springframework.cloud - spring-cloud-starter-loadbalancer - - - - org.projectlombok - lombok - true - - - - org.springframework.boot - spring-boot-starter-test - test - - - org.springframework.restdocs - spring-restdocs-mockmvc - test + spring-cloud-starter-gateway org.springframework.boot spring-boot-starter-security + + org.springframework.boot + spring-boot-starter-webflux + org.springdoc - springdoc-openapi-starter-webmvc-ui + springdoc-openapi-starter-webflux-ui 2.2.0 + + org.springframework.boot + spring-boot-starter-oauth2-resource-server + + + org.springframework.cloud + spring-cloud-starter-netflix-eureka-client + - - - - org.springframework.cloud - spring-cloud-dependencies - ${spring-cloud.version} - pom - import - - - @@ -100,18 +74,6 @@ - - org.springframework.boot - spring-boot-maven-plugin - - - - org.projectlombok - lombok - - - - diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..ebd117c --- /dev/null +++ b/pom.xml @@ -0,0 +1,81 @@ + + + 4.0.0 + + org.springframework.boot + spring-boot-starter-parent + 3.2.5 + + + com.learningpulse + server + 0.0.1 + pom + server + API server for LearningPulse + + gateway + eureka + dummy + + + 22 + 22 + 22 + 2023.0.1 + + + + org.springframework.boot + spring-boot-starter + + + org.springframework.boot + spring-boot-starter-test + test + + + + org.springframework.boot + spring-boot-starter-actuator + + + + + org.jetbrains + annotations + 24.1.0 + + + + + + + org.springframework.cloud + spring-cloud-dependencies + ${spring-cloud.version} + pom + import + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + + From 09a253f3ccf843995adbbb7872072b8fdda76fb3 Mon Sep 17 00:00:00 2001 From: hirst Date: Mon, 27 May 2024 17:22:29 +0200 Subject: [PATCH 9/9] updated .idea stuff --- .idea/encodings.xml | 2 ++ .idea/misc.xml | 1 + .idea/modules.xml | 8 -------- 3 files changed, 3 insertions(+), 8 deletions(-) delete mode 100644 .idea/modules.xml diff --git a/.idea/encodings.xml b/.idea/encodings.xml index ce1fbb5..0baf7c3 100644 --- a/.idea/encodings.xml +++ b/.idea/encodings.xml @@ -4,5 +4,7 @@ + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index edd914b..5e24c1c 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -8,6 +8,7 @@ diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index fbd90b4..0000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file