UnsatisfiedDependencyException:创建名称为“studentConrtroller”的 bean 时出错:通过字段“studentserv”表示不满足的依赖关系;

Posted

技术标签:

【中文标题】UnsatisfiedDependencyException:创建名称为“studentConrtroller”的 bean 时出错:通过字段“studentserv”表示不满足的依赖关系;【英文标题】:UnsatisfiedDependencyException: Error creating bean with name 'studentConrtroller': Unsatisfied dependency expressed through field 'studentserv'; 【发布时间】:2020-05-03 00:03:04 【问题描述】:
    @RestController
public class StudentConrtroller 

    @Autowired
    private StudentService studentserv; 

                 @SuppressWarnings("null")
                @RequestMapping( "/examination")
                 public void loadAllStudent(long attendCodeId) throws IOException   


                     StudentDto studentDto=studentserv.loadAttendancecodeId(attendCodeId);
                     if(studentDto==null ) 
                        studentDto.setCourseId(attendCodeId);
                    
        


    @Service
public interface StudentService 

    public StudentDto loadAttendancecodeId(long attendCodeId) throws IOException;





@Service
@Transactional
public class StudentServiceImpl implements StudentService

    @Autowired
    StudentDao stud;



    @Override
    public StudentDto loadAttendancecodeId(long attendCodeId) throws IOException 
        StudentDto StudentDto=new StudentDto();
        Student stu=stud.loadStudent(attendCodeId);

        if(stu !=null) 
            StudentDto.setActive(ExaminationUtil.activeInActiveStr(stu.getActive()));

            BeanUtils.copyProperties(stu, StudentDto);

        
        return  StudentDto;

报错怎么解决??????

org.springframework.beans.factory.UnsatisfiedDependencyException: 创建名为“studentConrtroller”的 bean 时出错:不满意 通过字段“studentserv”表达的依赖关系;嵌套异常是 org.springframework.beans.factory.UnsatisfiedDependencyException: 创建名为“studentServiceImpl”的 bean 时出错:不满意 通过字段“stud”表达的依赖关系;嵌套异常是 org.springframework.beans.factory.UnsatisfiedDependencyException: 创建名为“studentDAoImpl”的 bean 时出错:不满足的依赖关系 通过字段“repos”表示;嵌套异常是 org.springframework.beans.factory.BeanCreationException:错误 创建名为“studentRepositor”的 bean:调用 init 方法 失败的;嵌套异常是 java.lang.IllegalArgumentException: 方法公共摘要的查询验证失败 com.example.demo.Domain.model.Student com.example.demo.StudentRepository.StudentRepositor.findByAttendExamDetaiol_Id(long)! 在 org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:643) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE] 在 org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:116) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE] 在 org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:399) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE] 在 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1422) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE] 在 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:594) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE] 在 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE] 在 org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE] 在 org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE] 在 org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE] 在 org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE] 在 org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:879) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE] 在 org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:878) ~[spring-context-5.2.2.RELEASE.jar:5.2.2.RELEASE] 在 org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550) ~[spring-context-5.2.2.RELEASE.jar:5.2.2.RELEASE] 在 org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141) ~[spring-boot-2.2.2.RELEASE.jar:2.2.2.RELEASE] 在 org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747) [spring-boot-2.2.2.RELEASE.jar:2.2.2.RELEASE] 在 org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) [spring-boot-2.2.2.RELEASE.jar:2.2.2.RELEASE] 在 org.springframework.boot.SpringApplication.run(SpringApplication.java:315) [spring-boot-2.2.2.RELEASE.jar:2.2.2.RELEASE] 在 org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) [spring-boot-2.2.2.RELEASE.jar:2.2.2.RELEASE] 在 org.springframework.boot.SpringApplication.run(SpringApplication.java:1215) [spring-boot-2.2.2.RELEASE.jar:2.2.2.RELEASE] 在 com.example.demo.SpringExaminQueryNewJoinningApplication.main(SpringExaminQueryNewJoinningApplication.java:15) [类/:na] 引起:org.springframework.beans.factory.UnsatisfiedDependencyException: 创建名为“studentServiceImpl”的 bean 时出错:不满意 通过字段“stud”表达的依赖关系;嵌套异常是 org.springframework.beans.factory.UnsatisfiedDependencyException: 创建名为“studentDAoImpl”的 bean 时出错:不满足的依赖关系 通过字段“repos”表示;嵌套异常是 org.springframework.beans.factory.BeanCreationException:错误 创建名为“studentRepositor”的 bean:调用 init 方法 失败的;嵌套异常是 java.lang.IllegalArgumentException: 方法公共摘要的查询验证失败 com.example.demo.Domain.model.Student com.example.demo.StudentRepository.StudentRepositor.findByAttendExamDetaiol_Id(long)! 在 org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:643) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE] 在 org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:116) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE] 在 org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:399) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE] 在 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1422) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE] 在 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:594) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE] 在 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE] 在 org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE] 在 org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE] 在 org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE] 在 org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE] 在 org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE] 在 org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1287) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE] 在 org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1207) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE] 在 org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:640) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE] ...省略了19个常用框架 引起:org.springframework.beans.factory.UnsatisfiedDependencyException: 创建名为“studentDAoImpl”的 bean 时出错:不满足的依赖关系 通过字段“repos”表示;嵌套异常是 org.springframework.beans.factory.BeanCreationException:错误 创建名为“studentRepositor”的 bean:调用 init 方法 失败的;嵌套异常是 java.lang.IllegalArgumentException: 方法公共摘要的查询验证失败 com.example.demo.Domain.model.Student com.example.demo.StudentRepository.StudentRepositor.findByAttendExamDetaiol_Id(long)! 在 org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:643) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE] 在 org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:116) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE] 在 org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:399) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE] 在 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1422) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE] 在 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:594) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE] 在 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE] 在 org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE] 在 org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE] 在 org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE] 在 org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE] 在 org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE] 在 org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1287) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE] 在 org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1207) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE] 在 org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:640) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE] ...省略了32个常用框架 引起:org.springframework.beans.factory.BeanCreationException:错误 创建名为“studentRepositor”的 bean:调用 init 方法 失败的;嵌套异常是 java.lang.IllegalArgumentException: 方法公共摘要的查询验证失败 com.example.demo.Domain.model.Student com.example.demo.StudentRepository.StudentRepositor.findByAttendExamDetaiol_Id(long)! 在 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1796) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE] 在 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:595) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE] 在 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE] 在 org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE] 在 org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE] 在 org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE] 在 org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE] 在 org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE] 在 org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1287) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE] 在 org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1207) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE] 在 org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:640) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE] ...省略了45个常用框架 原因:java.lang.IllegalArgumentException:查询方法公共抽象的验证失败 com.example.demo.Domain.model.Student com.example.demo.StudentRepository.StudentRepositor.findByAttendExamDetaiol_Id(long)! 在 org.springframework.data.jpa.repository.query.SimpleJpaQuery.validateQuery(SimpleJpaQuery.java:93) ~[spring-data-jpa-2.2.3.RELEASE.jar:2.2.3.RELEASE] 在 org.springframework.data.jpa.repository.query.SimpleJpaQuery.(SimpleJpaQuery.java:63) ~[spring-data-jpa-2.2.3.RELEASE.jar:2.2.3.RELEASE] 在 org.springframework.data.jpa.repository.query.JpaQueryFactory.fromMethodWithQueryString(JpaQueryFactory.java:76) ~[spring-data-jpa-2.2.3.RELEASE.jar:2.2.3.RELEASE] 在 org.springframework.data.jpa.repository.query.JpaQueryFactory.fromQueryAnnotation(JpaQueryFactory.java:56) ~[spring-data-jpa-2.2.3.RELEASE.jar:2.2.3.RELEASE] 在 org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$DeclaredQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:142) ~[spring-data-jpa-2.2.3.RELEASE.jar:2.2.3.RELEASE] 在 org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$CreateIfNotFoundQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:209) ~[spring-data-jpa-2.2.3.RELEASE.jar:2.2.3.RELEASE] 在 org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$AbstractQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:79) ~[spring-data-jpa-2.2.3.RELEASE.jar:2.2.3.RELEASE] 在 org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.lookupQuery(RepositoryFactorySupport.java:574) ~[spring-data-commons-2.2.3.RELEASE.jar:2.2.3.RELEASE] 在 org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.lambda$mapMethodsToQuery$1(RepositoryFactorySupport.java:567) ~[spring-data-commons-2.2.3.RELEASE.jar:2.2.3.RELEASE] 在 java.util.stream.ReferencePipeline$3$1.accept(Unknown Source) ~[na:1.8.0_231] 在 java.util.Iterator.forEachRemaining(未知来源)~[na:1.8.0_231] 在 java.util.Collections$UnmodifiableCollection$1.forEachRemaining(未知 来源)~[na:1.8.0_231] 在 java.util.Spliterators$IteratorSpliterator.forEachRemaining(未知 来源)~[na:1.8.0_231] 在 java.util.stream.AbstractPipeline.copyInto(未知来源)~[na:1.8.0_231] 在 java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source) ~[na:1.8.0_231] 在 java.util.stream.ReduceOps$ReduceOp.evaluateSequential(未知来源)~[na:1.8.0_231] 在 java.util.stream.AbstractPipeline.evaluate(未知来源)~[na:1.8.0_231] 在 java.util.stream.ReferencePipeline.collect(未知来源)~[na:1.8.0_231] 在 org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.mapMethodsToQuery(RepositoryFactorySupport.java:569) ~[spring-data-commons-2.2.3.RELEASE.jar:2.2.3.RELEASE] 在 org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.lambda$new$0(RepositoryFactorySupport.java:559) ~[spring-data-commons-2.2.3.RELEASE.jar:2.2.3.RELEASE] 在 java.util.Optional.map(未知来源)~[na:1.8.0_231] 在 org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.(RepositoryFactorySupport.java:559) ~[spring-data-commons-2.2.3.RELEASE.jar:2.2.3.RELEASE] 在 org.springframework.data.repository.core.support.RepositoryFactorySupport.getRepository(RepositoryFactorySupport.java:332) ~[spring-data-commons-2.2.3.RELEASE.jar:2.2.3.RELEASE] 在 org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.lambda$afterPropertiesSet$5(RepositoryFactoryBeanSupport.java:297) ~[spring-data-commons-2.2.3.RELEASE.jar:2.2.3.RELEASE] 在 org.springframework.data.util.Lazy.getNullable(Lazy.java:212) ~[spring-data-commons-2.2.3.RELEASE.jar:2.2.3.RELEASE] 在 org.springframework.data.util.Lazy.get(Lazy.java:94) ~[spring-data-commons-2.2.3.RELEASE.jar:2.2.3.RELEASE] 在 org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.afterPropertiesSet(RepositoryFactoryBeanSupport.java:300) ~[spring-data-commons-2.2.3.RELEASE.jar:2.2.3.RELEASE] 在 org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean.afterPropertiesSet(JpaRepositoryFactoryBean.java:121) ~[spring-data-jpa-2.2.3.RELEASE.jar:2.2.3.RELEASE] 在 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1855) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE] 在 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1792) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE] ...省略了55个常用框架 引起:java.lang.IllegalArgumentException:org.hibernate.QueryException:节点没有数据类型: org.hibernate.hql.internal.ast.tree.IdentNode -[IDENT] IdentNode: 's' originalText=s [从 com.example.demo.Domain.model.Student 中选择 s] 在 org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:138) ~[hibernate-core-5.4.2.Final.jar:5.4.2.Final] 在 org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:181) ~[hibernate-core-5.4.2.Final.jar:5.4.2.Final] 在 org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:188) ~[hibernate-core-5.4.2.Final.jar:5.4.2.Final] 在 org.hibernate.internal.AbstractSharedSessionContract.createQuery(AbstractSharedSessionContract.java:729) ~[hibernate-core-5.4.2.Final.jar:5.4.2.Final] 在 org.hibernate.internal.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:23) ~[hibernate-core-5.4.2.Final.jar:5.4.2.Final] 在 sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_231] 在 sun.reflect.NativeMethodAccessorImpl.invoke(未知来源)~[na:1.8.0_231] 在 sun.reflect.DelegatingMethodAccessorImpl.invoke(未知来源)~[na:1.8.0_231] 在 java.lang.reflect.Method.invoke(未知来源)~[na:1.8.0_231] 在 org.springframework.orm.jpa.ExtendedEntityManagerCreator$ExtendedEntityManagerInvocationHandler.invoke(ExtendedEntityManagerCreator.java:368) ~[spring-orm-5.2.2.RELEASE.jar:5.2.2.RELEASE] 在 com.sun.proxy.$Proxy91.createQuery(Unknown Source) ~[na:na] 在 org.springframework.data.jpa.repository.query.SimpleJpaQuery.validateQuery(SimpleJpaQuery.java:87) ~[spring-data-jpa-2.2.3.RELEASE.jar:2.2.3.RELEASE] ...省略84个常用框架 原因:org.hibernate.QueryException:节点没有数据类型:org.hibernate.hql.internal.ast.tree.IdentNode -[IDENT] IdentNode: 's' originalText=s [从 com.example.demo.Domain.model.Student 中选择 s] 在 org.hibernate.QueryException.generateQueryException(QueryException.java:120) ~[hibernate-core-5.4.2.Final.jar:5.4.2.Final] 在 org.hibernate.QueryException.wrapWithQueryString(QueryException.java:103) ~[hibernate-core-5.4.2.Final.jar:5.4.2.Final] 在 org.hibernate.hql.internal.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:220) ~[hibernate-core-5.4.2.Final.jar:5.4.2.Final] 在 org.hibernate.hql.internal.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:144) ~[hibernate-core-5.4.2.Final.jar:5.4.2.Final] 在 org.hibernate.engine.query.spi.HQLQueryPlan.(HQLQueryPlan.java:118) ~[hibernate-core-5.4.2.Final.jar:5.4.2.Final] 在 org.hibernate.engine.query.spi.HQLQueryPlan.(HQLQueryPlan.java:78) ~[hibernate-core-5.4.2.Final.jar:5.4.2.Final] 在 org.hibernate.engine.query.spi.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:158) ~[hibernate-core-5.4.2.Final.jar:5.4.2.Final] 在 org.hibernate.internal.AbstractSharedSessionContract.getQueryPlan(AbstractSharedSessionContract.java:611) ~[hibernate-core-5.4.2.Final.jar:5.4.2.Final] 在 org.hibernate.internal.AbstractSharedSessionContract.createQuery(AbstractSharedSessionContract.java:720) ~[hibernate-core-5.4.2.Final.jar:5.4.2.Final] ...省略92个常用框架 原因:org.hibernate.QueryException:节点没有数据类型:org.hibernate.hql.internal.ast.tree.IdentNode -[IDENT] IdentNode: 's' originalText=s

  at org.hibernate.hql.internal.ast.tree.SelectClause.initializeExplicitSelectClause(SelectClause.java:161)

~[hibernate-core-5.4.2.Final.jar:5.4.2.Final] 在 org.hibernate.hql.internal.ast.HqlSqlWalker.useSelectClause(HqlSqlWalker.java:1018) ~[hibernate-core-5.4.2.Final.jar:5.4.2.Final] 在 org.hibernate.hql.internal.ast.HqlSqlWalker.processQuery(HqlSqlWalker.java:786) ~[hibernate-core-5.4.2.Final.jar:5.4.2.Final] 在 org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:677) ~[hibernate-core-5.4.2.Final.jar:5.4.2.Final] 在 org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:313) ~[hibernate-core-5.4.2.Final.jar:5.4.2.Final] 在 org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:261) ~[hibernate-core-5.4.2.Final.jar:5.4.2.Final] 在 org.hibernate.hql.internal.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:272) ~[hibernate-core-5.4.2.Final.jar:5.4.2.Final] 在 org.hibernate.hql.internal.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:192) ~[hibernate-core-5.4.2.Final.jar:5.4.2.Final] ...省略了98个常用帧`

【问题讨论】:

您可能需要检查:How to Ask 你真的读过堆栈跟踪吗? ->Validation failed for query for method public abstract com.example.demo.Domain.model.Student com.example.demo.StudentRepository.StudentRepositor.findByAttendExamDetaiol_Id(long)!。这很清楚地表明您的 findBy 方法命名不正确。 【参考方案1】:

正如我所见,@service 注释在 StudentServiceImpl 和 StudentService 上使用了两次。 去掉StudentService接口上的@service注解,放到StudentServiceImpl上。

【讨论】:

以上是关于UnsatisfiedDependencyException:创建名称为“studentConrtroller”的 bean 时出错:通过字段“studentserv”表示不满足的依赖关系;的主要内容,如果未能解决你的问题,请参考以下文章