带spEl注释的“无法针对BeanFactory解析bean引用”

时间:2019-06-01 16:36:29

标签: mysql spring spring-boot

我正在尝试接下来7天的编程。在我使用MySQL数据库在查询中使用dateadd之前,它无法正常工作,

因此,我尝试使用spEl批注来使用它,但出现此错误:

“无法针对BeanFactory解析bean引用”

您是否有解决此问题的方法或具有相同结果的替代方法?

Cannot complete the install because one or more required items could not be found.
  Software being installed: m2e - Maven Integration for Eclipse (includes Incubating components) 1.11.0.20190220-2119 (org.eclipse.m2e.feature.feature.group 1.11.0.20190220-2119)
  Missing requirement: org.eclipse.m2e.binaryproject.ui 1.11.0.20190220-2119 requires 'bundle org.eclipse.ui 0.0.0' but it could not be found
  Cannot satisfy dependency:
    From: m2e - Maven Integration for Eclipse (includes Incubating components) 1.11.0.20190220-2119 (org.eclipse.m2e.feature.feature.group 1.11.0.20190220-2119)
    To: org.eclipse.m2e.binaryproject.ui [1.11.0.20190220-2119]

致谢

2 个答案:

答案 0 :(得分:0)

#{@ProgrammationRepository.addSevenDay()}

上面的SpEL表示它将找到一个名为ProgrammationRepository的bean,并调用其addSevenDay()方法。

但是,ProgrammationRepository bean的名称是 p rogrammationRepository,但不是 P rogrammationRepository(Spring bean的默认名称是类名的lowerCamelCase)将SpEL更改为以下值即可解决问题:

#{@programmationRepository.addSevenDay()}

或者,您可以通过以下方式将ProgrammationRepository bean的名称更改为ProgrammationRepository:

@Repository(value = "ProgrammationRepository")
public interface ProgrammationRepository extends JpaRepository<Programmation, Long> {

}

答案 1 :(得分:0)

spring默认bean名称是小写的。因此,您可能需要尝试(N^2/8)/(N^2/8-N/4)

相关问题