commit 9f2da41bacd63c451d5251611e50375cea02d168 Author: Spring Developer Date: Sun Dec 21 10:17:36 2025 +0000 Initial commit: Spring Boot API with MySQL and Redis diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a771acc --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +build/ +.gradle/ +.idea/ +*.iml +*.log diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000..4c72a10 --- /dev/null +++ b/build.gradle @@ -0,0 +1,40 @@ +plugins { +id 'java' +id 'org.springframework.boot' version '3.2.1' +id 'io.spring.dependency-management' version '1.1.4' +} + +group = 'com.vrobot' +version = '0.0.1-SNAPSHOT' + +java { +sourceCompatibility = '17' +} + +configurations { +compileOnly { +extendsFrom annotationProcessor +} +} + +repositories { +mavenCentral() +} + +dependencies { +implementation 'org.springframework.boot:spring-boot-starter-data-jpa' +implementation 'org.springframework.boot:spring-boot-starter-data-redis' +implementation 'org.springframework.boot:spring-boot-starter-web' +implementation 'org.springframework.boot:spring-boot-starter-validation' +implementation 'org.springframework.boot:spring-boot-starter-actuator' + +compileOnly 'org.projectlombok:lombok' +runtimeOnly 'com.mysql:mysql-connector-j' +annotationProcessor 'org.projectlombok:lombok' + +testImplementation 'org.springframework.boot:spring-boot-starter-test' +} + +tasks.named('test') { +useJUnitPlatform() +} diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..d64cd49 Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..1af9e09 --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,7 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip +networkTimeout=10000 +validateDistributionUrl=true +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew new file mode 100755 index 0000000..fbff41e --- /dev/null +++ b/gradlew @@ -0,0 +1,2 @@ +APP_HOME=$(cd "$(dirname "$0")" && pwd -P) +exec java -classpath "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/src/main/java/com/vrobot/api/SpringbootApiApplication.java b/src/main/java/com/vrobot/api/SpringbootApiApplication.java new file mode 100644 index 0000000..6f4b3bd --- /dev/null +++ b/src/main/java/com/vrobot/api/SpringbootApiApplication.java @@ -0,0 +1,11 @@ +package com.vrobot.api; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class SpringbootApiApplication { + public static void main(String[] args) { + SpringApplication.run(SpringbootApiApplication.class, args); + } +} diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml new file mode 100644 index 0000000..fc81221 --- /dev/null +++ b/src/main/resources/application.yml @@ -0,0 +1,34 @@ +spring: + application: + name: springboot-api + datasource: + url: jdbc:mysql://mysql:3306/devdb?useSSL=false&serverTimezone=UTC&allowPublicKeyRetrieval=true + username: devuser + password: p4fH5NB0y22ytwrB + driver-class-name: com.mysql.cj.jdbc.Driver + jpa: + hibernate: + ddl-auto: update + show-sql: true + properties: + hibernate: + format_sql: true + dialect: org.hibernate.dialect.MySQLDialect + data: + redis: + host: redis + port: 6379 + timeout: 2000ms +server: + port: 8080 +management: + endpoints: + web: + exposure: + include: health,info,metrics + endpoint: + health: + show-details: always +logging: + level: + com.vrobot.api: DEBUG