kongdeqiang
2023-03-01 b5265214f54d17c527f7f74c0cb1fff0489635e2
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
package com.boying;
 
import cn.hutool.core.io.resource.ClassPathResource;
import net.sf.jni4net.Bridge;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.annotation.EnableScheduling;
 
import java.io.File;
import java.io.IOException;
 
/**
 * @author kdq
 * @version 1.0.0
 * @ClassName Application.java
 * @Description TODO
 * @createTime 2022年11月18日 15:46:00
 */
@SpringBootApplication
@EnableScheduling
public class Application {
    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }
 
    @Bean
    public static void getBean() throws IOException {
        Bridge.setVerbose(true);
        Bridge.init();
        //加载资源文件
        ClassPathResource classPathResource = new ClassPathResource("jni/LedShow.j4n.dll");
        File loadDll = classPathResource.getFile();
        Bridge.LoadAndRegisterAssemblyFrom(loadDll);
    }
}