Skip to content

Commit 9bcf814

Browse files
author
Jorgen-5
committed
Fix error
1 parent 91b60a2 commit 9bcf814

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

klass-api/src/main/java/no/ssb/klass/api/services/IndexServiceImpl.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import org.slf4j.LoggerFactory;
1616
import org.springframework.beans.factory.annotation.Autowired;
1717
import org.springframework.beans.factory.annotation.Value;
18+
import org.springframework.context.annotation.Lazy;
1819
import org.springframework.context.annotation.Profile;
1920
import org.springframework.data.elasticsearch.core.document.Document;
2021
import org.springframework.data.elasticsearch.core.mapping.IndexCoordinates;
@@ -58,16 +59,18 @@ public class IndexServiceImpl implements IndexService {
5859
private final ClassificationSeriesRepository classificationRepository;
5960
private final OpenSearchRestTemplate elasticsearchOperations;
6061
private final DocumentMapper documentMapper;
61-
private final IndexService self;
62+
63+
@Autowired
64+
@Lazy
65+
private IndexService indexService;
6266

6367
@Autowired
6468
public IndexServiceImpl(
6569
ClassificationSeriesRepository classificationRepository,
66-
OpenSearchRestTemplate elasticsearchOperations,IndexService self) {
70+
OpenSearchRestTemplate elasticsearchOperations) {
6771
this.classificationRepository = classificationRepository;
6872
this.elasticsearchOperations = elasticsearchOperations;
6973
this.documentMapper = new DocumentMapper();
70-
this.self = self;
7174
}
7275

7376
private IndexCoordinates getIndexCoordinates() {
@@ -162,7 +165,7 @@ public void indexAsync(Long classificationSeriesId) {
162165
try {
163166
ClassificationSeries classification =
164167
classificationRepository.getOne(classificationSeriesId);
165-
self.indexSync(classification);
168+
indexService.indexSync(classification);
166169
} catch (Exception e) {
167170
log.warn(
168171
"Failed to index classification {}: {}",

0 commit comments

Comments
 (0)