13693261870
2024-07-16 fc7aae282af8b5ca9544fe3579e7b09aa0295f62
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
package com.se.simu.config;
 
import com.se.simu.helper.GdalHelper;
import com.se.simu.helper.WebHelper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
 
import javax.annotation.Resource;
 
/**
 * 初始化配置类
 *
 * @author WWW
 * @date 2024-07-16
 */
@Slf4j
@Component
public class InitConfig implements ApplicationRunner {
    @Resource
    Environment env;
 
    @Value("${server.port}")
    String serverPort;
 
    @Value("${server.servlet.context-path}")
    String contextPath;
 
    @Override
    public void run(ApplicationArguments args) {
        // noinspection AlibabaRemoveCommentedCode
        try {
            log.info("***************** 初始化 GDAL *****************" + "\n");
            GdalHelper.init(env.getProperty("sys.path.gdal"));
 
            String path = null != contextPath && contextPath.length() > 1 ? contextPath : "";
            log.info("API文档:http://localhost:" + serverPort + path + "/doc.html");
            log.info("API文档:http://{}:{}{}/doc.html", WebHelper.getHostIp(), serverPort, path);
 
            log.info("***************** 系统启动完毕 *****************" + "\n");
        } catch (Exception ex) {
            log.error(ex.getMessage(), ex);
        }
    }
}