URL-3 Spring Boot skeletons for the service

This commit is contained in:
LenaGmbh
2025-12-16 17:58:35 +01:00
parent 9ecf26eee5
commit 23241f4af1
13 changed files with 213 additions and 11 deletions

View File

@@ -1,19 +1,41 @@
plugins {
id 'java'
id 'org.springframework.boot' version '3.5.8' apply false
id 'io.spring.dependency-management' version '1.1.7' apply false
}
group 'me.lenajenichen'
version '1.0-SNAPSHOT'
allprojects {
group 'me.lenajenichen'
version '0.0.1-SNAPSHOT'
repositories {
repositories {
mavenCentral()
}
}
dependencies {
subprojects {
apply plugin: 'java'
// Only the actual service applications (under :services:...) are Spring Boot apps.
// Aggregator/helper projects like :services and :test should not apply Spring Boot.
if (project.path.startsWith(':services:')) {
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
dependencies {
implementation 'org.springframework.boot:spring-boot-starter'
implementation 'org.springframework.boot:spring-boot-starter-web'
// Ensure R2DBC SPI is on the classpath to satisfy Boot's autoconfiguration checks
implementation 'io.r2dbc:r2dbc-spi'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.1'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.1'
}
}
}
test {
tasks.withType(Test).configureEach {
useJUnitPlatform()
}
}

View File

@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

View File

@@ -0,0 +1,23 @@
plugins {
id 'java'
}
group 'me.lenajenichen'
version '0.0.1-SNAPSHOT'
springBoot {
mainClass = 'AnalyticsServiceApplication'
}
repositories {
mavenCentral()
}
dependencies {
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.1'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.1'
}
test {
useJUnitPlatform()
}

View File

@@ -0,0 +1,13 @@
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class AnalyticsServiceApplication {
public static void main(String[] args) {
SpringApplication.run(AnalyticsServiceApplication.class, args);
}
}

View File

@@ -0,0 +1,23 @@
plugins {
id 'java'
}
group 'me.lenajenichen'
version '0.0.1-SNAPSHOT'
springBoot {
mainClass = 'AuthServiceApplication'
}
repositories {
mavenCentral()
}
dependencies {
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.1'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.1'
}
test {
useJUnitPlatform()
}

View File

@@ -0,0 +1,13 @@
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class AuthServiceApplication {
public static void main(String[] args) {
SpringApplication.run(AuthServiceApplication.class, args);
}
}

View File

@@ -0,0 +1,23 @@
plugins {
id 'java'
}
group 'me.lenajenichen'
version '0.0.1-SNAPSHOT'
springBoot {
mainClass = 'RedirectServiceApplication'
}
repositories {
mavenCentral()
}
dependencies {
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.1'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.1'
}
test {
useJUnitPlatform()
}

View File

@@ -0,0 +1,13 @@
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class RedirectServiceApplication {
public static void main(String[] args) {
SpringApplication.run(RedirectServiceApplication.class, args);
}
}

View File

@@ -0,0 +1,23 @@
plugins {
id 'java'
}
group 'me.lenajenichen'
version '0.0.1-SNAPSHOT'
repositories {
mavenCentral()
}
springBoot {
mainClass = 'shortener.ShortenerServiceApplication'
}
dependencies {
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.1'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.1'
}
test {
useJUnitPlatform()
}

View File

@@ -0,0 +1,15 @@
package api;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/health")
public class HealthController {
@GetMapping
public String health() {
return "OK";
}
}

View File

@@ -0,0 +1,15 @@
package shortener;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;
@SpringBootApplication
@ComponentScan(basePackages = {"shortener", "api"})
public class ShortenerServiceApplication {
public static void main(String[] args) {
SpringApplication.run(ShortenerServiceApplication.class, args);
}
}

View File

@@ -0,0 +1,6 @@
spring:
application:
name: shortener-service
server:
port: 8083

View File

@@ -1,2 +1,15 @@
rootProject.name = 'URLShortener'
include 'test'
include 'services'
include 'services:analytics-service'
findProject(':services:analytics-service')?.name = 'analytics-service'
include 'services:auth-service'
findProject(':services:auth-service')?.name = 'auth-service'
include 'services:redirect-service'
findProject(':services:redirect-service')?.name = 'redirect-service'
include 'services:shortener-service'
findProject(':services:shortener-service')?.name = 'shortener-service'