Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 无法自动连线[错误:没有类型匹配的bean]_Java_Spring_Hibernate_Jpa - Fatal编程技术网

Java 无法自动连线[错误:没有类型匹配的bean]

Java 无法自动连线[错误:没有类型匹配的bean],java,spring,hibernate,jpa,Java,Spring,Hibernate,Jpa,我试图部署我的项目,但我得到了这个错误,我没有解决它 org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'educationUserDetailsBuilder': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCre

我试图部署我的项目,但我得到了这个错误,我没有解决它

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'educationUserDetailsBuilder': Injection of autowired dependencies failed; nested exception is
org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.metaarchit.education.school.persistence.SemesterDao com.metaarchit.education.framework.security.spring.EducationUserDetailsBuilder.semesterDao; nested exception is 
org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [com.metaarchit.education.school.persistence.SemesterDao] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
    at 
org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:285)

我不知道我应该发布什么,如果你需要其他可以提供帮助的东西,请告诉我你需要什么文件。

你在什么地方有一个类
semestrado
,对吗?您可能在代码中做了类似的操作:

public class MyClass {
@Autowire
private SemesterDao semesterDao;
...
只有当Spring知道如何创建它的实例时,它才能正常工作。您可以通过进入类并在其上添加名为
Component
的注释来实现这一点:

@Component
public class SemesterDao {
}

出于好奇,当使用Spring时,通常也会使用Spring数据,通过这种方式,您可以扩展
JpaRepository
,并且已经实现了许多有用的方法。您可以在这里进一步了解这一点:

您在什么地方有一个类
semestrado
,对吗?您可能在代码中做了类似的操作:

public class MyClass {
@Autowire
private SemesterDao semesterDao;
...
只有当Spring知道如何创建它的实例时,它才能正常工作。您可以通过进入类并在其上添加名为
Component
的注释来实现这一点:

@Component
public class SemesterDao {
}

出于好奇,当使用Spring时,通常也会使用Spring数据,通过这种方式,您可以扩展
JpaRepository
,并且已经实现了许多有用的方法。您可以在这里进一步查看:

该死!我不知道使用“”不会自动创建新行Damn!我不知道使用“”不会自动创建新行。我试图在Semestedao类上添加@Component,但似乎没有用。我还有一个类,它的函数与
semestrado
相同,并且没有注释,但是它们可以成功地自动连接。我的一些配置文件有误吗?如果你需要配置文件,请告诉我。我忘了说
semestedao
是一个接口classI我试图在semestedao类上添加@Component,但似乎没有用。我还有一个类,它的函数与
semestrado
相同,并且没有注释,但是它们可以成功地自动连接。我的一些配置文件出错了吗?如果需要配置文件,请告诉我。我忘了说
semestrado
是一个接口类