Spring boot 在启动应用程序之前是否遇到此错误?
启动ApplicationContext时出错。要显示条件报告,请在启用“调试”的情况下重新运行应用程序。 2018-04-12 18:47:51.811错误340---[main]o.s.b.d.记录故障分析报告员:Spring boot 在启动应用程序之前是否遇到此错误?,spring-boot,Spring Boot,启动ApplicationContext时出错。要显示条件报告,请在启用“调试”的情况下重新运行应用程序。 2018-04-12 18:47:51.811错误340---[main]o.s.b.d.记录故障分析报告员: 应用程序无法启动 说明: com.example.lead.controller.LeadController中的字段leadRepository需要找不到类型为“com.example.lead.repo.leadRepository”的bean 行动: 考虑在配置中定义“
应用程序无法启动
说明: com.example.lead.controller.LeadController中的字段leadRepository需要找不到类型为“com.example.lead.repo.leadRepository”的bean 行动: 考虑在配置中定义“com.example.lead.repo.LeadRepository”类型的bean。
package com.example.lead.repo;
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);
}
导入org.springframework.beans.factory.annotation.Autowired;
导入org.springframework.context.annotation.Bean;
//导入org.springframework.context.annotation.ComponentScan;
导入org.springframework.data.jpa.repository.JpaRepository;
导入org.springframework.stereotype.Repository;
导入com.example.leadmodel.Lead;
导入com.example.leadmodel.leadeEntity;
@存储库
公共接口LeadRepository扩展了JpaRepository{
@豆子
@自动连线
Lead findOne(整数Lead_id);
作废保存(LeadEntity LeadEntity);
}
show code of controller and repository能否显示类com.example.lead.repo.LeadRepository
(完整的代码,带注释)还有主应用程序类的@ComponentScan
注释?我已经提到了上面提到的所有内容。但我无法启动应用程序。我面临着错误。但我不知道为什么会这样。