潘志宝
2024-09-23 0a2f6f78683ba1c4e07f1359c1e7bf105a4bd507
提交 | 用户 | 时间
a6de49 1 package com.iailab;
H 2
3 import org.springframework.boot.CommandLineRunner;
4 import org.springframework.boot.SpringApplication;
5 import org.springframework.boot.autoconfigure.SpringBootApplication;
7fd198 6 import com.iail.IAILMDK;
449017 7 import org.springframework.cloud.openfeign.EnableFeignClients;
7fd198 8 import org.springframework.scheduling.annotation.EnableAsync;
a6de49 9
449017 10 import java.io.File;
7fd198 11 import java.io.InputStream;
449017 12 import java.util.Objects;
7fd198 13 import java.util.Properties;
14
15 @EnableAsync
a6de49 16 @SpringBootApplication
H 17 public class ModelServiceApplication implements CommandLineRunner {
18
bbc1ee 19     /*static {
7fd198 20         //加载动态链接库
21         try {
22             Properties properties = new Properties();
23             InputStream in = ModelServiceApplication.class.getClassLoader().getResourceAsStream("iailmdk.properties");
24             properties.load(in);
25             String mdkInitPath = properties.getProperty("mdk-init-path");
26             System.out.println("mdkInitPath=" + mdkInitPath);
27             IAILMDK.initWithBean(mdkInitPath, false);
28         } catch (Exception e) {
29             e.printStackTrace();
30             System.out.println("动态链接库IAILMDK初始化失败");
31         }
449017 32
D 33         try {
34             System.out.println("动态加载dll");
35             String dllDir = Objects.requireNonNull(ModelServiceApplication.class.getClassLoader().getResource("dll")).getPath();
36             File dir = new File(dllDir);
37             if (dir.exists()) {
38                 File[] files = dir.listFiles();
39                 if (files.length > 0) {
40                     for (File file : files) {
41                         System.out.println("加载:" + file.getAbsolutePath());
42                         System.load(file.getAbsolutePath());
43                     }
44                 }
45             }
46         } catch (Exception e) {
47             e.printStackTrace();
48             System.out.println("动态加载dll失败");
49         }
50
7fd198 51     }
bbc1ee 52 */
a6de49 53
H 54     public static void main(String[] args) {
55         SpringApplication.run(ModelServiceApplication.class, args);
56     }
57
58     /**
59      * 容器初始化后加载路由
60      *
61      * @param strings
62      */
63     @Override
64     public void run(String... strings) {
65     }
66 }