更新到SpringBoot4

This commit is contained in:
TheWhiteDog9487
2025-12-11 17:07:45 +08:00
parent 6c3f94feb3
commit 2e34240455
5 changed files with 30 additions and 24 deletions
+23 -15
View File
@@ -1,13 +1,14 @@
plugins { plugins {
java java
id("org.springframework.boot") version "3.5.6" id("org.springframework.boot") version "4.0.0"
id("io.spring.dependency-management") version "1.1.7" id("io.spring.dependency-management") version "1.1.7"
id("org.graalvm.buildtools.native") version "0.10.6" id("org.hibernate.orm") version "7.1.8.Final"
id("org.graalvm.buildtools.native") version "0.11.3"
id("org.springdoc.openapi-gradle-plugin") version "1.9.0" id("org.springdoc.openapi-gradle-plugin") version "1.9.0"
} }
group = "xyz.thewhitedog9487" group = "xyz.thewhitedog9487"
version = "0.7.1" version = "0.7.3"
java { java {
toolchain { toolchain {
@@ -26,24 +27,31 @@ repositories {
} }
dependencies { dependencies {
implementation("org.springframework.boot:spring-boot-starter-actuator")
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-data-redis")
implementation("org.springframework.boot:spring-boot-starter-jdbc")
implementation("org.springframework.boot:spring-boot-starter-security") implementation("org.springframework.boot:spring-boot-starter-security")
implementation("org.springframework.boot:spring-boot-starter-web") implementation("org.springframework.boot:spring-boot-starter-webmvc")
implementation("org.springframework.boot:spring-boot-starter-data-jpa")
implementation("org.xerial:sqlite-jdbc")
implementation("org.hibernate.orm:hibernate-community-dialects")
implementation("com.discord4j:discord4j-core:3.2.8")
implementation("com.fasterxml.jackson.core:jackson-core:2.19.2")
implementation("org.springdoc:springdoc-openapi-starter-webmvc-ui:2.8.13")
implementation("org.springdoc:springdoc-openapi-starter-webmvc-api:2.8.9")
implementation("org.springframework.boot:spring-boot-starter-actuator")
compileOnly("org.projectlombok:lombok") compileOnly("org.projectlombok:lombok")
developmentOnly("org.springframework.boot:spring-boot-devtools") developmentOnly("org.springframework.boot:spring-boot-devtools")
developmentOnly("org.springframework.boot:spring-boot-docker-compose") // developmentOnly("org.springframework.boot:spring-boot-docker-compose")
runtimeOnly("org.xerial:sqlite-jdbc")
annotationProcessor("org.springframework.boot:spring-boot-configuration-processor")
annotationProcessor("org.projectlombok:lombok") annotationProcessor("org.projectlombok:lombok")
testImplementation("org.springframework.boot:spring-boot-starter-test") testImplementation("org.springframework.boot:spring-boot-starter-actuator-test")
testImplementation("org.springframework.security:spring-security-test") testImplementation("org.springframework.boot:spring-boot-starter-data-jpa-test")
testImplementation("org.springframework.boot:spring-boot-starter-data-redis-test")
testImplementation("org.springframework.boot:spring-boot-starter-jdbc-test")
testImplementation("org.springframework.boot:spring-boot-starter-security-test")
testImplementation("org.springframework.boot:spring-boot-starter-webmvc-test")
testRuntimeOnly("org.junit.platform:junit-platform-launcher") testRuntimeOnly("org.junit.platform:junit-platform-launcher")
implementation("org.hibernate.orm:hibernate-community-dialects")
implementation("com.discord4j:discord4j-core:3.3.0")
implementation("tools.jackson.core:jackson-core:3.0.3")
implementation("org.springdoc:springdoc-openapi-starter-webmvc-ui:3.0.0")
implementation("org.springdoc:springdoc-openapi-starter-webmvc-api:3.0.0")
} }
tasks.withType<Test> { tasks.withType<Test> {
+1 -1
View File
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-9.1.0-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.0-bin.zip
networkTimeout=10000 networkTimeout=10000
validateDistributionUrl=true validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
@@ -49,7 +49,7 @@ class RegisterGraalVMBuildHints implements RuntimeHintsRegistrar{
hints.reflection().registerType(clazz,b -> b.withMembers( hints.reflection().registerType(clazz,b -> b.withMembers(
MemberCategory.INVOKE_DECLARED_CONSTRUCTORS, MemberCategory.INVOKE_DECLARED_CONSTRUCTORS,
MemberCategory.INVOKE_DECLARED_METHODS, MemberCategory.INVOKE_DECLARED_METHODS,
MemberCategory.DECLARED_FIELDS)); MemberCategory.ACCESS_DECLARED_FIELDS));
ok++; ok++;
} catch (Throwable e) { } catch (Throwable e) {
// 有些类可能因缺失依赖/被 JDK 模块限制而加载失败,跳过即可 // 有些类可能因缺失依赖/被 JDK 模块限制而加载失败,跳过即可
@@ -65,7 +65,7 @@ class RegisterGraalVMBuildHints implements RuntimeHintsRegistrar{
builder -> builder.withMembers( builder -> builder.withMembers(
MemberCategory.INVOKE_DECLARED_CONSTRUCTORS, MemberCategory.INVOKE_DECLARED_CONSTRUCTORS,
MemberCategory.INVOKE_DECLARED_METHODS, MemberCategory.INVOKE_DECLARED_METHODS,
MemberCategory.DECLARED_FIELDS MemberCategory.ACCESS_DECLARED_FIELDS
) )
); );
@@ -74,7 +74,7 @@ class RegisterGraalVMBuildHints implements RuntimeHintsRegistrar{
builder -> builder.withMembers( builder -> builder.withMembers(
MemberCategory.INVOKE_DECLARED_CONSTRUCTORS, MemberCategory.INVOKE_DECLARED_CONSTRUCTORS,
MemberCategory.INVOKE_DECLARED_METHODS, MemberCategory.INVOKE_DECLARED_METHODS,
MemberCategory.DECLARED_FIELDS MemberCategory.ACCESS_DECLARED_FIELDS
) )
); );
@@ -83,7 +83,7 @@ class RegisterGraalVMBuildHints implements RuntimeHintsRegistrar{
builder -> builder.withMembers( builder -> builder.withMembers(
MemberCategory.INVOKE_DECLARED_CONSTRUCTORS, MemberCategory.INVOKE_DECLARED_CONSTRUCTORS,
MemberCategory.INVOKE_DECLARED_METHODS, MemberCategory.INVOKE_DECLARED_METHODS,
MemberCategory.DECLARED_FIELDS MemberCategory.ACCESS_DECLARED_FIELDS
) )
); );
@@ -92,7 +92,7 @@ class RegisterGraalVMBuildHints implements RuntimeHintsRegistrar{
builder -> builder.withMembers( builder -> builder.withMembers(
MemberCategory.INVOKE_DECLARED_CONSTRUCTORS, MemberCategory.INVOKE_DECLARED_CONSTRUCTORS,
MemberCategory.INVOKE_DECLARED_METHODS, MemberCategory.INVOKE_DECLARED_METHODS,
MemberCategory.DECLARED_FIELDS MemberCategory.ACCESS_DECLARED_FIELDS
) )
); );
@@ -23,7 +23,7 @@ class OpenAPIConfiguration {
.contact(new Contact() .contact(new Contact()
.name("TheWhiteDog9487") .name("TheWhiteDog9487")
.url("https://www.github.com/TheWhiteDog9487/WebAPI")) .url("https://www.github.com/TheWhiteDog9487/WebAPI"))
.version("0.7.1") .version("0.7.3")
.license(new License() .license(new License()
.name("WTFPL") .name("WTFPL")
.url("https://spdx.org/licenses/WTFPL")) ) .url("https://spdx.org/licenses/WTFPL")) )
@@ -6,7 +6,6 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.RandomStringUtils; import org.apache.commons.lang3.RandomStringUtils;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import xyz.thewhitedog9487.WebAPI.Configuration.Security.ApiKeyAuthenticationFilter;
import java.io.IOException; import java.io.IOException;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
@@ -19,7 +18,6 @@ import java.util.concurrent.locks.ReentrantLock;
@Slf4j @Slf4j
@Component @Component
class GlobalSharedBean { class GlobalSharedBean {
@Bean @Bean
GatewayDiscordClient GetDiscordClient(){ GatewayDiscordClient GetDiscordClient(){
String DiscordBotToken = System.getenv("Discord_Bot_Token"); String DiscordBotToken = System.getenv("Discord_Bot_Token");