Skip to content

Commit

Permalink
make RuntimeHintsConfiguration a Spring bean
Browse files Browse the repository at this point in the history
  • Loading branch information
danthe1st committed Nov 23, 2024
1 parent 01111e9 commit 45ff52d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/net/discordjug/javabot/SpringConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -34,7 +33,6 @@
* This class holds all configuration settings and {@link Bean}s.
*/
@Configuration
@ImportRuntimeHints(RuntimeHintsConfiguration.class)
@RequiredArgsConstructor
public class SpringConfig {
@Bean
Expand Down

0 comments on commit 45ff52d

Please sign in to comment.