zhanghua
2025-03-04 0f5901bbc027e2e8d934280ca659734a61f67378
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
57
58
59
60
61
package com.ycl;
 
import com.dahua.netsdk.AppDemo;
import com.ycl.util.SpringContextUtil;
import com.ycl.util.VideoUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.core.env.Environment;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.transaction.annotation.EnableTransactionManagement;
 
import java.net.InetAddress;
import java.net.UnknownHostException;
 
@Slf4j
@Configuration
@EnableAspectJAutoProxy(proxyTargetClass = true, exposeProxy = true)
@EnableAsync(proxyTargetClass = true)
@EnableScheduling
@EnableFeignClients
@EnableTransactionManagement(proxyTargetClass = true)
@SpringBootApplication(scanBasePackages = "com.ycl")
public class PlatformApplication {
    public static void main(String[] args) throws UnknownHostException {
        ConfigurableApplicationContext application = SpringApplication.run(PlatformApplication.class, args);
 
        Environment env = application.getEnvironment();
        log.info("\n----------------------------------------------------------\n\t" +
                        "应用 '{}' 运行成功! 访问连接:\n\t" +
                        "Swagger文档: \t\thttp://{}:{}{}/doc.html\n\t" +
                        "数据库监控: \t\thttp://{}:{}/druid\n" +
                        "----------------------------------------------------------",
                env.getProperty("spring.application.name"),
                InetAddress.getLocalHost().getHostAddress(),
                env.getProperty("server.port"),
                env.getProperty("server.servlet.context-path"),
                "127.0.0.1",
                env.getProperty("server.port"));
 
        try {
            new AppDemo().start();
        } catch (Exception e) {
            log.info("执行大华报警程序出错:", e.getMessage());
        }
 
//        try {
//            // 启动时,保存上下文,并保存为静态
//            SpringContextUtil.setAc(application);
//            new OSSImageMove().start();
//        } catch (Exception e) {
//            log.info("图片程序出错:", e.getMessage());
//        }
    }
}