| 1234567891011121314151617181920212223242526272829303132333435363738 |
- package com.doc.common.data;
- import lombok.extern.slf4j.Slf4j;
- import org.springframework.context.ApplicationContext;
- import org.springframework.context.ConfigurableApplicationContext;
- import org.springframework.data.DataVerify;
- import org.springframework.scheduling.annotation.Scheduled;
- import org.springframework.stereotype.Component;
- import javax.annotation.Resource;
- /**
- * 授权许可验证监听器
- *
- * @author wukai
- * @date 2023-12-29
- */
- @Component
- @Slf4j
- public class DataService {
- @Resource
- private ApplicationContext context;
- @Scheduled(cron = "15 28 3 ? * 7")
- public void check() {
- try {
- DataVerify dataVerify = new DataVerify();
- //校验证书是否有效
- if (!dataVerify.verify()) {
- throw new Exception();
- }
- } catch (Exception e) {
- ((ConfigurableApplicationContext) context).close();
- throw new RuntimeException("证书校验失败!!!");
- }
- }
- }
|