spring data elasticsearch Invocation of init method failed; nested exception is java.lang.AbstractMethodError

Viewed 3961

I have problem with Spring Data Elasticsearch. I configure elasticsearch like this:

@Configuration
@EnableJpaRepositories(basePackages = {"org.project.repositories"})
@EnableElasticsearchRepositories(basePackages = "org.project.repositorieselastic")
@EnableTransactionManagement
public class PersistenceContext {
@Bean
public ElasticsearchOperations elasticsearchTemplate() {
    return new ElasticsearchTemplate(client());
}

@Bean
public Client client(){

    Settings settings = ImmutableSettings.settingsBuilder()
        // Setting "transport.type" enables this module:
        .put("cluster.name", "elasticsearch")
        .put("client.transport.ignore_cluster_name", false)
        .build();


    TransportClient client= new TransportClient(settings);
    TransportAddress address = new InetSocketTransportAddress("127.0.0.1", 9300);
    client.addTransportAddress(address);
    return client;
}

}

My repo looks like.

@Repository()
public interface UserFavoriteElasticRepo extends ElasticsearchRepository<UserFavorite, Long> {

}

Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: org.project.repositorieselastic.UserFavoriteElasticRepo org.project.services.elastic.FavoriteIndexerService.elasticRepo; nested exception
is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userFavoriteElasticRepo': Invocation of init method failed; nested exception is java.lang.AbstractMethodError

It's look like the implementation is not generated. But I don't know where to investigate. I tried to use one package and use this - https://github.com/izeye/spring-boot-throwaway-branches/commit/874ccba09189d6ef897bc430c43b6e3705404399 but with no success.

2 Answers
Related