From bbb439eb16a73feeba43e6b5c7d9a4627c1e25a2 Mon Sep 17 00:00:00 2001 From: Josh Lagrimas Date: Thu, 13 Apr 2023 17:32:17 +0100 Subject: [PATCH 1/2] re-add annotation in SolrIndexer --- .../src/main/java/uk/ac/ebi/spot/indexer/SolrIndexer.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/oxo-indexer/src/main/java/uk/ac/ebi/spot/indexer/SolrIndexer.java b/oxo-indexer/src/main/java/uk/ac/ebi/spot/indexer/SolrIndexer.java index eb16565..0d4469f 100644 --- a/oxo-indexer/src/main/java/uk/ac/ebi/spot/indexer/SolrIndexer.java +++ b/oxo-indexer/src/main/java/uk/ac/ebi/spot/indexer/SolrIndexer.java @@ -5,6 +5,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.CommandLineRunner; import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; @@ -27,6 +28,7 @@ @SpringBootApplication @EnableNeo4jRepositories(basePackages = "uk.ac.ebi.spot.repository") @EnableSolrRepositories(basePackages = "uk.ac.ebi.spot.index", basePackageClasses = {Document.class}) +@EnableAutoConfiguration @EnableConfigurationProperties @ComponentScan({"uk.ac.ebi"}) public class SolrIndexer implements CommandLineRunner { From 060c8f21c2f06b6b7d18e03787c7b03780126826 Mon Sep 17 00:00:00 2001 From: Josh Lagrimas Date: Wed, 19 Apr 2023 09:49:05 +0100 Subject: [PATCH 2/2] introduce exiting once indexing is done --- .../src/main/java/uk/ac/ebi/spot/indexer/SolrIndexer.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/oxo-indexer/src/main/java/uk/ac/ebi/spot/indexer/SolrIndexer.java b/oxo-indexer/src/main/java/uk/ac/ebi/spot/indexer/SolrIndexer.java index 0d4469f..8f6ac8b 100644 --- a/oxo-indexer/src/main/java/uk/ac/ebi/spot/indexer/SolrIndexer.java +++ b/oxo-indexer/src/main/java/uk/ac/ebi/spot/indexer/SolrIndexer.java @@ -5,7 +5,6 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.CommandLineRunner; import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; @@ -28,7 +27,6 @@ @SpringBootApplication @EnableNeo4jRepositories(basePackages = "uk.ac.ebi.spot.repository") @EnableSolrRepositories(basePackages = "uk.ac.ebi.spot.index", basePackageClasses = {Document.class}) -@EnableAutoConfiguration @EnableConfigurationProperties @ComponentScan({"uk.ac.ebi"}) public class SolrIndexer implements CommandLineRunner { @@ -43,17 +41,18 @@ public class SolrIndexer implements CommandLineRunner { SolrClient solrClient() { return new HttpSolrClient(environment.getProperty("spring.data.solr.host")); } + @Bean public SolrTemplate solrTemplate() { return new SolrTemplate(solrClient(), "mapping"); } - + @Override public void run(String... strings) throws Exception { termService.rebuildIndexes(); } public static void main(String[] args) throws Exception { - SpringApplication.run(SolrIndexer.class, args); + SpringApplication.exit(SpringApplication.run(SolrIndexer.class, args)); } }