Jay
2024-10-08 79914dabac38d83676ea16ff65da8d941a099285
提交 | 用户 | 时间
a6de49 1 package com.iailab;
H 2
912a1e 3 import iail.mdk.model.common.Environment;
a6de49 4 import org.springframework.boot.CommandLineRunner;
H 5 import org.springframework.boot.SpringApplication;
6 import org.springframework.boot.autoconfigure.SpringBootApplication;
7fd198 7 import org.springframework.scheduling.annotation.EnableAsync;
a6de49 8
912a1e 9 import java.io.File;
D 10 import java.io.InputStream;
7fd198 11 import java.util.Properties;
12
13 @EnableAsync
a6de49 14 @SpringBootApplication
H 15 public class ModelServiceApplication implements CommandLineRunner {
16
137356 17     static {
7fd198 18         //加载动态链接库
19         try {
20             Properties properties = new Properties();
912a1e 21             InputStream in = ModelServiceApplication.class.getClassLoader().getResourceAsStream("iailmdk.properties");
D 22             properties.load(in);
23             String mdkInitPath = properties.getProperty("mdk-init-path");
24             System.out.println("mdkInitPath=" + mdkInitPath);
25             File file = new File(mdkInitPath + File.separator + "IAIL.MDK.Mid.Windows.dll");
26             if (!file.exists()) {
27                 throw new RuntimeException("动态链接库IAIL.MDK.Mid.Windows.dll文件不存在," + file.getAbsolutePath());
28             }
29             System.load(file.getAbsolutePath());
30             Environment env = new Environment();
31             env.init();
7fd198 32         } catch (Exception e) {
33             e.printStackTrace();
1fea3e 34             System.out.println("动态链接库IAIL.MDK.Mid.Windows.dll初始化失败");
7fd198 35         }
449017 36
7fd198 37     }
137356 38
a6de49 39
H 40     public static void main(String[] args) {
41         SpringApplication.run(ModelServiceApplication.class, args);
42     }
43
44     /**
45      * 容器初始化后加载路由
46      *
47      * @param strings
48      */
49     @Override
50     public void run(String... strings) {
51     }
52 }