项目依赖
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.0.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-elasticearch</artifactId>
</dependency>
项目结构
Repository代码
package com.allqj.learner_autonomy.base.repository;
import com.allqj.learner_autonomy.base.entity.es.StudentES;
import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;
public interface IStudentRepository extends ElasticsearchRepository<StudentES, Long> {
}
项目启动不了原因
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2019-02-14 18:34:07.085 ERROR 2364 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
APPLICATION FAILED TO START
***************************
Description:
Field iStudentRepository in com.allqj.learner_autonomy.base.service.impl.StudentServiceImpl required a bean of type 'com.allqj.learner_autonomy.base.repository.IStudentRepository' that could not be found.
Action:
Consider defining a bean of type 'com.allqj.learner_autonomy.base.repository.IStudentRepository' in your configuration.
Process finished with exit code 1
其中试过加@Component和@Repository注解 但是都没用。