AppListener

2020/1/1

点击勘误issues (opens new window),哪吒感谢大家的阅读

# AppListener

/**
 * 应用启动监听器
 */
@Component
@Slf4j
public class AppListener implements ApplicationListener<ApplicationReadyEvent> {
    // 创建一个静态的Logger对象
    static Logger logger = LoggerFactory.getLogger(AppListener.class);

    // 实现ApplicationListener接口的onApplicationEvent方法
    @Override
    public void onApplicationEvent(final ApplicationReadyEvent event) {
        try {

        } catch (Exception e) {
            // 如果发生异常,记录错误日志
            logger.error(e.getMessage(), e);
        }
    }
}