# Elasticsearch not working after spring-boot upgrade to 2.2.0.RELEASE

**URL:** <https://discuss.elastic.co/t/elasticsearch-not-working-after-spring-boot-upgrade-to-2-2-0-release/288849>\
**Category:** Elasticsearch\
**Tags:** language-clients\
**Created:** [November 10, 2021, 7:43am UTC](https://discuss.elastic.co/t/elasticsearch-not-working-after-spring-boot-upgrade-to-2-2-0-release/288849 "2021-11-10T07:43:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![simarjsi](https://avatars.discourse-cdn.com/v4/letter/s/ed8c4c/32.png) [@simarjsi](https://discuss.elastic.co/u/simarjsi)\
**Post date:** [November 10, 2021, 7:43am UTC](https://discuss.elastic.co/t/elasticsearch-not-working-after-spring-boot-upgrade-to-2-2-0-release/288849/1 "2021-11-10T07:43:09Z")

</div>

I am upgrading one of our applications from spring-boot version 2.1.3.RELEASE to 2.2.0.RELEASE but I am facing some issues with Elasticsearch. Here is the error I am getting

```auto
java.lang.IllegalStateException: Failed to load ApplicationContext
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'customCdrElasticConfig': Unsatisfied dependency expressed through field 'elasticsearchTemplate'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.springframework.data.elasticsearch.core.ElasticsearchTemplate' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true), @org.springframework.beans.factory.annotation.Qualifier(value=elasticsearchTemplate)}
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.springframework.data.elasticsearch.core.ElasticsearchTemplate' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true), @org.springframework.beans.factory.annotation.Qualifier(value=elasticsearchTemplate)}

```

Code

```auto
package com.codex.reporting.config;

import com.codex.reporting.elasticsearch.service.impl.CustomElasticsearchTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.elasticsearch.core.ElasticsearchTemplate;

@Configuration
public class CustomCdrElasticConfig {

    @Autowired
    @Qualifier("elasticsearchTemplate")
    private ElasticsearchTemplate elasticsearchTemplate;

    @Bean
    public CustomElasticsearchTemplate customElasticsearchTemplate(){
        return new CustomElasticsearchTemplate(elasticsearchTemplate.getClient());
    }
}

```

pom.xml

```auto
        <dependency>
            <groupId>org.elasticsearch.client</groupId>
            <artifactId>x-pack-transport</artifactId>
            <version>6.8.13</version>
        </dependency>
        <!-- Dependency for high level rest client, for Rest Client -->
        <dependency>
            <groupId>org.elasticsearch.client</groupId>
            <artifactId>elasticsearch-rest-client</artifactId>
            <version>6.8.13</version>
        </dependency>
        <!-- For Rest High Level Client -->
        <dependency>
            <groupId>org.elasticsearch.client</groupId>
            <artifactId>elasticsearch-rest-high-level-client</artifactId>
            <version>6.8.13</version>
        </dependency>
        <!-- Dependency for high level rest client, for elasticsearch Core -->
        <dependency>
            <groupId>org.elasticsearch</groupId>
            <artifactId>elasticsearch-core</artifactId>
            <version>6.8.13</version>
        </dependency>

```

Would appreciate any leads on this. Thanks

---

<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:** [December 8, 2021, 7:43am UTC](https://discuss.elastic.co/t/elasticsearch-not-working-after-spring-boot-upgrade-to-2-2-0-release/288849/2 "2021-12-08T07:43:10Z")

</div>

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