File tree Expand file tree Collapse file tree
java/liuyuyang/net/common Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11package liuyuyang .net .common .listener ;
22
3+ import liuyuyang .net .common .properties .BaiduProperties ;
34import liuyuyang .net .web .service .impl .BaiduServiceImpl ;
45import lombok .extern .slf4j .Slf4j ;
56import org .springframework .boot .context .event .ApplicationReadyEvent ;
1314public class BaiduTokenStartupListener implements ApplicationListener <ApplicationReadyEvent > {
1415 @ Resource
1516 private BaiduServiceImpl baiduService ;
17+ @ Resource
18+ private BaiduProperties baiduProperties ;
1619
1720 @ Override
1821 public void onApplicationEvent (ApplicationReadyEvent event ) {
22+ // 如果是关闭状态,则不检查
23+ if (!baiduProperties .getIsOpen ()) return ;
24+
1925 log .info ("应用启动完成,开始检查百度统计 Token 状态" );
2026
2127 try {
Original file line number Diff line number Diff line change 88@ Component
99@ ConfigurationProperties (prefix = "lyy.baidu" )
1010public class BaiduProperties {
11+ private Boolean isOpen ;
1112 private String clientKey ;
1213 private String clientSecret ;
1314 private String refreshToken ;
Original file line number Diff line number Diff line change 1515 username : ${EMAIL_USERNAME}
1616 password : ${EMAIL_PASSWORD}
1717 baidu :
18+ isOpen : ${BAIDU_IS_OPEN}
1819 clientKey : ${BAIDU_CLIENT_KEY}
1920 clientSecret : ${BAIDU_CLIENT_SECRET}
2021 refreshToken : ${BAIDU_REFRESH_TOKEN}
Original file line number Diff line number Diff line change 1515 username : ${EMAIL_USERNAME}
1616 password : ${EMAIL_PASSWORD}
1717 baidu :
18+ isOpen : ${BAIDU_IS_OPEN}
1819 clientKey : ${BAIDU_CLIENT_KEY}
1920 clientSecret : ${BAIDU_CLIENT_SECRET}
2021 refreshToken : ${BAIDU_REFRESH_TOKEN}
You can’t perform that action at this time.
0 commit comments