在启动应用程序之前我是否面临此错误?

时间:2018-04-12 13:22:45

标签: spring-boot

启动ApplicationContext时出错。要显示条件报告,请在启用“debug”的情况下重新运行应用程序。 2018-04-12 18:47:51.811 ERROR 340 --- [main] o.s.b.d.LoggingFailureAnalysisReporter:

申请失败

说明

com.example.lead.controller.LeadController中的字段leadRepository需要一个无法找到的类型为'com.example.lead.repo.LeadRepository'的bean。

动作:

考虑在配置中定义'com.example.lead.repo.LeadRepository'类型的bean。

1 个答案:

答案 0 :(得分:0)

package com.example.lead.repo;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
// import org.springframework.context.annotation.ComponentScan;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;


import com.example.leadmodel.Lead;
import com.example.leadmodel.LeadEntity;


@Repository 
public interface LeadRepository extends JpaRepository<Lead, Integer> {
    @Bean
    @Autowired
    Lead findOne(Integer lead_id);

    void save(LeadEntity leadEntity);

}
相关问题