xiangpei
7 天以前 2226679bda25ddf977f12367a9a37fcf4e377249
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package cn.lili.init;
 
import cn.lili.modules.search.service.EsGoodsIndexService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;
 
/**
 * @author paulG
 * @since 2022/6/9
 **/
@Component
@Slf4j
public class EsGoodsIndexInitRunner implements ApplicationRunner {
 
    @Autowired
    private EsGoodsIndexService esGoodsIndexService;
 
 
    @Override
    public void run(ApplicationArguments args) {
        try {
            esGoodsIndexService.initIndex();
        } catch (Exception e) {
            log.error("检测ES商品索引失败", e);
        }
    }
}