package com.example.his.api;

import com.example.his.api.async.InitializeWorkAsync;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import javax.annotation.PostConstruct;
import javax.annotation.Resource;

@SpringBootApplication
@ServletComponentScan
@EnableAsync
@EnableScheduling
@ComponentScan("com.example.*")
@MapperScan("com.example.his.api.db.dao")
@EnableCaching
public class HisApiApplication {

    @Resource
    private InitializeWorkAsync initializeWorkAsync;

    public static void main(String[] args) {
        SpringApplication.run(HisApiApplication.class, args);
    }

    //这里是新添加的代码
    @PostConstruct
    public void init() {
        initializeWorkAsync.init();
    }

}
