From 45ff52daa9b5b0d4ac4f8ccf8d2851417d8c48f0 Mon Sep 17 00:00:00 2001 From: danthe1st <daniel@wwwmaster.at> Date: Sat, 23 Nov 2024 18:13:38 +0100 Subject: [PATCH] make RuntimeHintsConfiguration a Spring bean --- .../net/discordjug/javabot/RuntimeHintsConfiguration.java | 7 ++++++- src/main/java/net/discordjug/javabot/SpringConfig.java | 2 -- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main/java/net/discordjug/javabot/RuntimeHintsConfiguration.java b/src/main/java/net/discordjug/javabot/RuntimeHintsConfiguration.java index 7c9b6c974..bf1560607 100644 --- a/src/main/java/net/discordjug/javabot/RuntimeHintsConfiguration.java +++ b/src/main/java/net/discordjug/javabot/RuntimeHintsConfiguration.java @@ -7,6 +7,7 @@ import net.discordjug.javabot.data.config.GuildConfig; import net.discordjug.javabot.data.config.GuildConfigItem; import net.discordjug.javabot.data.config.SystemsConfig; +import net.discordjug.javabot.data.config.SystemsConfig.ApiConfig; import net.discordjug.javabot.data.config.guild.HelpConfig; import net.discordjug.javabot.data.config.guild.MessageCacheConfig; import net.discordjug.javabot.data.config.guild.MetricsConfig; @@ -32,14 +33,18 @@ import org.springframework.aot.hint.RuntimeHints; import org.springframework.aot.hint.RuntimeHintsRegistrar; import org.springframework.aot.hint.annotation.RegisterReflectionForBinding; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.ImportRuntimeHints; import org.springframework.core.io.ClassPathResource; /** * Configure classes and resources to be accessible from native-image. */ +@Configuration +@ImportRuntimeHints(RuntimeHintsConfiguration.class) @RegisterReflectionForBinding({ //register config classes for reflection - BotConfig.class, GuildConfig.class, GuildConfigItem.class,SystemsConfig.class, + BotConfig.class, GuildConfig.class, GuildConfigItem.class, SystemsConfig.class, ApiConfig.class, HelpConfig.class, MessageCacheConfig.class, MetricsConfig.class, ModerationConfig.class, QOTWConfig.class, ServerLockConfig.class, StarboardConfig.class, //ensure JDA can create necessary caches diff --git a/src/main/java/net/discordjug/javabot/SpringConfig.java b/src/main/java/net/discordjug/javabot/SpringConfig.java index fe07deebf..1faae73d5 100644 --- a/src/main/java/net/discordjug/javabot/SpringConfig.java +++ b/src/main/java/net/discordjug/javabot/SpringConfig.java @@ -10,7 +10,6 @@ import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.ImportRuntimeHints; import xyz.dynxsty.dih4jda.DIH4JDA; import xyz.dynxsty.dih4jda.DIH4JDABuilder; import xyz.dynxsty.dih4jda.exceptions.DIH4JDAException; @@ -34,7 +33,6 @@ * This class holds all configuration settings and {@link Bean}s. */ @Configuration -@ImportRuntimeHints(RuntimeHintsConfiguration.class) @RequiredArgsConstructor public class SpringConfig { @Bean