zyy
2025-12-09 6eef7f43f9ad3d82727fba36f543f268cfb646d2
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
package com.yami.trading;
 
import com.alicp.jetcache.anno.config.EnableMethodCache;
import com.yami.trading.common.util.ApplicationUtil;
import com.yami.trading.service.impl.InternalEmailSenderServiceImpl;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.retry.annotation.EnableRetry;
import org.springframework.scheduling.annotation.EnableScheduling;
 
import javax.annotation.PostConstruct;
import java.util.TimeZone;
 
/**
 * @author lgh
 */
@EnableRetry
@EnableScheduling
@SpringBootApplication
@ComponentScan("com.yami.trading")
@EnableMethodCache(basePackages = "com.yami.trading")
public class WebApplication extends SpringBootServletInitializer {
 
    @PostConstruct
    void init() {
        // 配置时区
        String timeZone = ApplicationUtil.getProperty("config.timezone.record", "GMT+8");
        TimeZone.setDefault(TimeZone.getTimeZone(timeZone));
    }
 
    public static void main(String[] args) {
        SpringApplication.run(WebApplication.class, args);
    }
 
    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
        return builder.sources(WebApplication.class);
    }
 
    @Bean
    public InternalEmailSenderServiceImpl internalEmailSenderService(){
        return  new InternalEmailSenderServiceImpl();
    }
 
    @Bean
    public EmailServer emailServer(){
        return  new EmailServer();
    }
 
    @Bean
    public SmsServer  smsServer(){
        return  new SmsServer();
    }
}