diff --git a/framework/gateway/src/main/java/io/metersphere/gateway/config/RsaConfig.java b/framework/gateway/src/main/java/io/metersphere/gateway/config/RsaConfig.java index e7ee11308c..dd7d782cad 100644 --- a/framework/gateway/src/main/java/io/metersphere/gateway/config/RsaConfig.java +++ b/framework/gateway/src/main/java/io/metersphere/gateway/config/RsaConfig.java @@ -3,17 +3,19 @@ package io.metersphere.gateway.config; import io.metersphere.commons.utils.RsaKey; import io.metersphere.commons.utils.RsaUtil; import io.metersphere.gateway.service.FileService; -import org.springframework.context.event.ContextRefreshedEvent; -import org.springframework.context.event.EventListener; +import org.springframework.boot.ApplicationArguments; +import org.springframework.boot.ApplicationRunner; +import org.springframework.context.annotation.Configuration; import javax.annotation.Resource; -public class RsaConfig { +@Configuration +public class RsaConfig implements ApplicationRunner { @Resource private FileService fileService; - @EventListener - public void rsaKey(ContextRefreshedEvent event) throws Exception { + @Override + public void run(ApplicationArguments args) throws Exception { RsaKey value = fileService.checkRsaKey(); // 保存到缓存中 RsaUtil.setRsaKey(value);