YYC
2023-10-19 ed18e7c5d3cb3bb237cbf9eed2447ca3721258c5
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
62
63
64
65
66
67
68
69
70
package com.ld.igds;
 
import com.bstek.dorado.web.loader.DoradoLoader;
import com.ld.igds.config.d7.DoradoApplicationContextInilializer;
 
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer;
import org.springframework.boot.context.embedded.EmbeddedServletContainerCustomizer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.scheduling.annotation.EnableAsync;
 
import java.util.LinkedHashSet;
import java.util.Set;
 
/**
 * 启动配置
 *
 * @author Andy
 */
@EnableAsync
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
@ComponentScan(basePackages = {"com.ld.license","com.ld.onvif"})
public class IgdsApplication {
 
 
    public static void main(String[] args) {
        System.setProperty("doradoHome", "classpath:dorado-home/");
        SpringApplication app = new SpringApplication(IgdsApplication.class);
        app.addInitializers(new DoradoApplicationContextInilializer());
 
        DoradoLoader doradoLoader = DoradoLoader.getInstance();
        try {
            doradoLoader.preload(true);
        } catch (Exception e) {
            e.printStackTrace();
        }
        Set<Object> sources = new LinkedHashSet<>();
        sources.addAll(doradoLoader.getContextLocations(false));
        app.setSources(sources);
 
        app.run(args);
 
 
        System.out.println("* ");
        System.out.println("* ========================");
        System.out.println("* ");
        System.out.println("* IGDS 项目启动成功…………");
        System.out.println("* ");
        System.out.println("* ========================");
        System.out.println("* ");
    }
 
    /**
     * SESSION会话周期控制,调整阶段控制为7天
     *
     * @return
     */
    @Bean
    public EmbeddedServletContainerCustomizer containerCustomizer() {
        return new EmbeddedServletContainerCustomizer() {
            @Override
            public void customize(ConfigurableEmbeddedServletContainer container) {
                container.setSessionTimeout(7 * 24 * 60 * 60);// 单位为S
            }
        };
    }
}