refactor: 网关启动时配置rsa
This commit is contained in:
parent
80f88ebd32
commit
1e913b3793
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue