package cn.hnthyy.thmz.common;

import cn.hnthyy.thmz.service.thmz.TokenService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationListener;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.event.ContextRefreshedEvent;

/**
 * 服务启动后立即执行
 */
@Configuration
public class ApplicationStartup implements ApplicationListener<ContextRefreshedEvent> {
    @Autowired
    private TokenService tokenService;

    //项目启动后，执行初始化token缓存
    @Override
    public void onApplicationEvent(ContextRefreshedEvent contextRefreshedEvent) {
        tokenService.initCacheMap();
    }

}