| Line 4... |
Line 4... |
| 4 |
import org.slf4j.Logger;
|
4 |
import org.slf4j.Logger;
|
| 5 |
import org.slf4j.LoggerFactory;
|
5 |
import org.slf4j.LoggerFactory;
|
| 6 |
import org.springframework.beans.factory.annotation.Autowired;
|
6 |
import org.springframework.beans.factory.annotation.Autowired;
|
| 7 |
import org.springframework.beans.factory.annotation.Value;
|
7 |
import org.springframework.beans.factory.annotation.Value;
|
| 8 |
import org.springframework.context.ApplicationListener;
|
8 |
import org.springframework.context.ApplicationListener;
|
| - |
|
9 |
import org.springframework.context.annotation.Profile;
|
| 9 |
import org.springframework.context.event.ContextRefreshedEvent;
|
10 |
import org.springframework.context.event.ContextRefreshedEvent;
|
| 10 |
import org.springframework.stereotype.Component;
|
11 |
import org.springframework.stereotype.Component;
|
| 11 |
|
12 |
|
| 12 |
/**
|
13 |
/**
|
| 13 |
* Triggers a full Solr sync on application startup.
|
14 |
* Triggers a full Solr sync on application startup.
|
| 14 |
* Ensures data consistency after application restarts.
|
15 |
* Ensures data consistency after application restarts.
|
| 15 |
* Only active in production environment.
|
16 |
* Only active in production environment.
|
| 16 |
*/
|
17 |
*/
|
| 17 |
@Component
|
18 |
@Component
|
| - |
|
19 |
@Profile("scheduled")
|
| 18 |
public class SolrStartupSync implements ApplicationListener<ContextRefreshedEvent> {
|
20 |
public class SolrStartupSync implements ApplicationListener<ContextRefreshedEvent> {
|
| 19 |
|
21 |
|
| 20 |
private static final Logger logger = LoggerFactory.getLogger(SolrStartupSync.class);
|
22 |
private static final Logger logger = LoggerFactory.getLogger(SolrStartupSync.class);
|
| 21 |
private boolean executed = false;
|
23 |
private boolean executed = false;
|
| 22 |
|
24 |
|