1- package ai .chat2db .server .start .config .config ;
2-
3- import ai .chat2db .server .tools .common .model .ConfigJson ;
4- import ai .chat2db .server .tools .common .util .ConfigUtils ;
5- import lombok .extern .slf4j .Slf4j ;
6- import org .apache .commons .lang3 .StringUtils ;
7- import org .springframework .context .ApplicationListener ;
8- import org .springframework .context .event .ContextRefreshedEvent ;
9- import org .springframework .scheduling .annotation .Async ;
10- import org .springframework .stereotype .Component ;
11-
12- /**
13- * Execute tasks after startup is completed
14- *
15- * @author Jiaju Zhuang
16- */
17- @ Component
18- @ Slf4j
19- public class AsyncContextRefreshedListener implements ApplicationListener <ContextRefreshedEvent > {
20- @ Override
21- @ Async
22- public void onApplicationEvent (ContextRefreshedEvent event ) {
23- // Successfully set up startup
24- String currentVersion = ConfigUtils .getLocalVersion ();
25- ConfigJson configJson = ConfigUtils .getConfig ();
26- if (StringUtils .isNotBlank (currentVersion ) && !StringUtils .equals (currentVersion ,
27- configJson .getLatestStartupSuccessVersion ())) {
28- configJson .setLatestStartupSuccessVersion (currentVersion );
29- ConfigUtils .setConfig (configJson );
30- }
31- }
32- }
1+ // package ai.chat2db.server.start.config.config;
2+ //
3+ // import ai.chat2db.server.tools.common.model.ConfigJson;
4+ // import ai.chat2db.server.tools.common.util.ConfigUtils;
5+ // import lombok.extern.slf4j.Slf4j;
6+ // import org.apache.commons.lang3.StringUtils;
7+ // import org.springframework.context.ApplicationListener;
8+ // import org.springframework.context.event.ContextRefreshedEvent;
9+ // import org.springframework.scheduling.annotation.Async;
10+ // import org.springframework.stereotype.Component;
11+ //
12+ /// **
13+ // * Execute tasks after startup is completed
14+ // *
15+ // * @author Jiaju Zhuang
16+ // */
17+ // @Component
18+ // @Slf4j
19+ // public class AsyncContextRefreshedListener implements ApplicationListener<ContextRefreshedEvent> {
20+ // @Override
21+ // @Async
22+ // public void onApplicationEvent(ContextRefreshedEvent event) {
23+ // // Successfully set up startup
24+ // String currentVersion = ConfigUtils.getLocalVersion();
25+ // ConfigJson configJson = ConfigUtils.getConfig();
26+ // if (StringUtils.isNotBlank(currentVersion) && !StringUtils.equals(currentVersion,
27+ // configJson.getLatestStartupSuccessVersion())) {
28+ // configJson.setLatestStartupSuccessVersion(currentVersion);
29+ // ConfigUtils.setConfig(configJson);
30+ // }
31+ // }
32+ // }
0 commit comments