Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spring Boot - Disable embedded ElasticSearch without removing code or changing POM

I'm looking for a way to prevent ElasticSearch for starting (embedded or separate server) in a Spring Boot project. ES is currently not in use, but will be at a later stage in the project.

If I remove the lines from the POM, my code needs major updates, because all annotations to ES cannot be found anymore.

Is there a way I can keep my project intact, but prevent ES from launching (embedded)?

My goal is to speed up restarts for the time being, when ES is not in use.

Or course, I could also run ES as a separate server, but I don't want to spend the time.

Thanks

like image 986
Wouter Avatar asked Dec 14 '22 01:12

Wouter


1 Answers

Add the following exclude to your @SpringBootApplication

import org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchAutoConfiguration;

@SpringBootApplication(exclude = ElasticsearchAutoConfiguration.class)
like image 165
Jobin Avatar answered Jan 23 '23 04:01

Jobin