Initial commit: Spring Boot API with MySQL and Redis

This commit is contained in:
Spring Developer
2025-12-21 10:17:36 +00:00
commit 9f2da41bac
7 changed files with 99 additions and 0 deletions

5
.gitignore vendored Normal file
View File

@@ -0,0 +1,5 @@
build/
.gradle/
.idea/
*.iml
*.log

40
build.gradle Normal file
View File

@@ -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()
}

BIN
gradle/wrapper/gradle-wrapper.jar vendored Normal file

Binary file not shown.

View File

@@ -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

2
gradlew vendored Executable file
View File

@@ -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 "$@"

View File

@@ -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);
}
}

View File

@@ -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