File size: 2,114 Bytes
d04c26a |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
package com.jetbrains.help;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.net.Ipv4Util;
import cn.hutool.core.text.CharSequenceUtil;
import cn.hutool.core.util.StrUtil;
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.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();
}
}
|