Jetbrains-Help/src/main/java/com/jetbrains/help/JetbrainsHelpApplication.java
2024-09-10 02:10:05 +08:00

58 lines
2.2 KiB
Java

package com.jetbrains.help;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.io.IoUtil;
import cn.hutool.core.net.Ipv4Util;
import cn.hutool.core.text.CharSequenceUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.crypto.SecureUtil;
import cn.hutool.extra.spring.SpringUtil;
import com.jetbrains.help.context.*;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.context.annotation.Import;
import org.springframework.context.event.EventListener;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import java.net.InetAddress;
import java.security.cert.Certificate;
import java.util.Collection;
import java.util.List;
@Slf4j
@EnableScheduling
@Import(SpringUtil.class)
@SpringBootApplication
public class JetbrainsHelpApplication {
public static void main(String[] args) {
SpringApplication.run(JetbrainsHelpApplication.class, args);
}
@SneakyThrows
@EventListener(ApplicationReadyEvent.class)
public void ready() {
ProductsContextHolder.init();
PluginsContextHolder.init();
CertificateContextHolder.init();
AgentContextHolder.init();
InetAddress localHost = InetAddress.getLocalHost();
String address = CharSequenceUtil.format("http://{}:{}", localHost.getHostAddress(), SpringUtil.getProperty("server.port"));
String runSuccessWarn = "\n====================================================================================\n" +
"= Jetbrains-Help Run Success~ =\n" +
"= address:" + address + " =\n" +
"====================================================================================\n";
log.info(runSuccessWarn);
}
@Scheduled(cron = "0 0 12 * * ?")
public void refresh() {
PluginsContextHolder.refreshJsonFile();
}
}