# RestHighLevelClient in spring boot 2.1.x doesn't allow a spring cloud task to finish successfully

**URL:** <https://discuss.elastic.co/t/resthighlevelclient-in-spring-boot-2-1-x-doesnt-allow-a-spring-cloud-task-to-finish-successfully/180176>\
**Category:** Elasticsearch\
**Created:** [May 8, 2019, 1:24pm UTC](https://discuss.elastic.co/t/resthighlevelclient-in-spring-boot-2-1-x-doesnt-allow-a-spring-cloud-task-to-finish-successfully/180176 "2019-05-08T13:24:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![VernonG](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vernong/32/45819_2.png) [@VernonG](https://discuss.elastic.co/u/VernonG)\
**Post date:** [May 8, 2019, 1:24pm UTC](https://discuss.elastic.co/t/resthighlevelclient-in-spring-boot-2-1-x-doesnt-allow-a-spring-cloud-task-to-finish-successfully/180176/1 "2019-05-08T13:24:10Z")

</div>

**Steps to reproduce** :

1. Clone [https://github.com/spring-cloud/spring-cloud-task/tree/master/spring-cloud-task-samples/timestamp](https://github.com/spring-cloud/spring-cloud-task/tree/master/spring-cloud-task-samples/timestamp)
2. Run the application - The service dies after it prints the timestamp
3. Add:

```auto
                <dependency>
			<groupId>org.elasticsearch.client</groupId>
			<artifactId>elasticsearch-rest-high-level-client</artifactId>
			<version>7.0.0</version>
		</dependency>

```

1. Re-run the application - The service now stays alive

**Notes**  
With:  
Spring Cloud Task - Finchley.SR3  
Spring Boot - 2.0.x  
Rest High Level Client - 6.4.2  
The app functions as intended.  
With:  
Spring Cloud Task - Greenwich.SR1  
Spring Boot -2.1.x  
Rest High Level Client - 6.4.2  
The app exhibits the problematic behavior

Adding a configuration and beaning the RestHighLevelClient and closing the connection on task completion has no affect on this functionality.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [June 3, 2019, 8:43am UTC](https://discuss.elastic.co/t/resthighlevelclient-in-spring-boot-2-1-x-doesnt-allow-a-spring-cloud-task-to-finish-successfully/180176/2 "2019-06-03T08:43:26Z")

</div>

How do you run the application? Is it with `mvn run`?

When using springboot with  
elasticsearch, you need to be explicit with some transitive dependencies as SpringBoot declares a version 6.4...

Basically you can put this in your `pom.xml`:

```auto
<properties>
  <elasticsearch.version>7.0.0<elasticsearch.version>
</properties>

```

See documentation here: [https://docs.spring.io/spring-boot/docs/current/reference/html/howto-build.html#howto-customize-dependency-versions](https://docs.spring.io/spring-boot/docs/current/reference/html/howto-build.html#howto-customize-dependency-versions)

May be that could help.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 1, 2019, 8:43am UTC](https://discuss.elastic.co/t/resthighlevelclient-in-spring-boot-2-1-x-doesnt-allow-a-spring-cloud-task-to-finish-successfully/180176/3 "2019-07-01T08:43:27Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
