Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/spring-mvc/2.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
Spring mvc 创建基本存储库类时出错 import org.springframework.data.jpa.repository.support.JpaEntityInformation; 导入org.springframework.data.jpa.repository.support.QueryDslJpaRepository; 导入org.springframework.data.querydsl.EntityPathResolver; 导入org.springframework.data.repository.NoRepositoryBean; 导入org.springframework.transaction.annotation.Transactional; 导入javax.persistence.EntityManager; @菜豆 公共类RepositorySupportImpl扩展了QueryDslJpaRepository实现了RepositorySupport{ 私人实体管理者实体管理者; public Repository SupportImpl(JpaEntityInformation entityInformation、EntityManager EntityManager、EntityManager EntityManager 1){ 超级(实体信息、实体管理器); this.entityManager=entityManager1; } public Repository SupportImpl(JpaEntityInformation entityInformation、EntityManager EntityManager、EntityPath resolver resolver、EntityManager EntityManager 1){ 超级(实体信息、实体管理器、解析器); this.entityManager=entityManager1; } @凌驾 公共实体管理器getEntityManager(){ 返回此.entityManager; } @交易的 @凌驾 公共S保存(最终S实体){ this.getEntityManager().persist(实体); 返回实体; }_Spring Mvc - Fatal编程技术网

Spring mvc 创建基本存储库类时出错 import org.springframework.data.jpa.repository.support.JpaEntityInformation; 导入org.springframework.data.jpa.repository.support.QueryDslJpaRepository; 导入org.springframework.data.querydsl.EntityPathResolver; 导入org.springframework.data.repository.NoRepositoryBean; 导入org.springframework.transaction.annotation.Transactional; 导入javax.persistence.EntityManager; @菜豆 公共类RepositorySupportImpl扩展了QueryDslJpaRepository实现了RepositorySupport{ 私人实体管理者实体管理者; public Repository SupportImpl(JpaEntityInformation entityInformation、EntityManager EntityManager、EntityManager EntityManager 1){ 超级(实体信息、实体管理器); this.entityManager=entityManager1; } public Repository SupportImpl(JpaEntityInformation entityInformation、EntityManager EntityManager、EntityPath resolver resolver、EntityManager EntityManager 1){ 超级(实体信息、实体管理器、解析器); this.entityManager=entityManager1; } @凌驾 公共实体管理器getEntityManager(){ 返回此.entityManager; } @交易的 @凌驾 公共S保存(最终S实体){ this.getEntityManager().persist(实体); 返回实体; }

Spring mvc 创建基本存储库类时出错 import org.springframework.data.jpa.repository.support.JpaEntityInformation; 导入org.springframework.data.jpa.repository.support.QueryDslJpaRepository; 导入org.springframework.data.querydsl.EntityPathResolver; 导入org.springframework.data.repository.NoRepositoryBean; 导入org.springframework.transaction.annotation.Transactional; 导入javax.persistence.EntityManager; @菜豆 公共类RepositorySupportImpl扩展了QueryDslJpaRepository实现了RepositorySupport{ 私人实体管理者实体管理者; public Repository SupportImpl(JpaEntityInformation entityInformation、EntityManager EntityManager、EntityManager EntityManager 1){ 超级(实体信息、实体管理器); this.entityManager=entityManager1; } public Repository SupportImpl(JpaEntityInformation entityInformation、EntityManager EntityManager、EntityPath resolver resolver、EntityManager EntityManager 1){ 超级(实体信息、实体管理器、解析器); this.entityManager=entityManager1; } @凌驾 公共实体管理器getEntityManager(){ 返回此.entityManager; } @交易的 @凌驾 公共S保存(最终S实体){ this.getEntityManager().persist(实体); 返回实体; },spring-mvc,Spring Mvc,} import org.springframework.data.jpa.repository.JpaRepository; 导入org.springframework.data.querydsl.querydsl谓词执行器; 导入javax.persistence.EntityManager; 公共接口RepositorySupport扩展了JpaRepository、QueryDSL谓词执行器{ EntityManager getEntityManager(); } 在我的配置类中,我有

}

import org.springframework.data.jpa.repository.JpaRepository;
导入org.springframework.data.querydsl.querydsl谓词执行器;
导入javax.persistence.EntityManager;
公共接口RepositorySupport扩展了JpaRepository、QueryDSL谓词执行器{
EntityManager getEntityManager();
}
在我的配置类中,我有repositoryBaseClass=RepositorySupportImpl.class

但我得到了这个错误:


org.springframework.beans.factory.UnsatifiedPendencyException:创建名为“registerService”的bean时出错:通过字段“userRepository”表示未满足的依赖关系;嵌套异常为org.springframework.beans.factory.BeanCreationException:创建名为“userRepository”的bean时出错:调用init方法失败;嵌套异常为java.lang.IllegalStateException:在类ca.lighthouse.repository.RepositorySupportImpl上找不到与给定参数匹配的合适构造函数:[class org.springframework.data.jpa.repository.support.jpametametamodelentityInformation,class com.sun.proxy.$Proxy52]。确保您实现了一个构造函数,并使用了这些

谢谢您的评论,它现在就可以工作了。我希望我能明确指出这个问题,但我不能。这是一个场景,我有一个SpringMVC应用程序,其中包含控制器、实体、业务服务、JSP,我想清理一下,所以我决定将项目分解为模块。因此,我创建了一个新项目,添加了模块,然后将文件从旧项目复制到新项目中。当我复制RepositorySupport类和接口时,我认为应该将其重命名为您在上面看到的名称。这导致了这个错误,经过几天的研究和尝试后,我决定复制到原始文件中,并且成功了。这就是我所做的,复制文件并更新参考资料

谢谢你的评论,现在可以用了。我希望我能明确指出这个问题,但我不能。这是一个场景,我有一个SpringMVC应用程序,其中包含控制器、实体、业务服务、JSP,我想清理一下,所以我决定将项目分解为模块。因此,我创建了一个新项目,添加了模块,然后将文件从旧项目复制到新项目中。当我复制RepositorySupport类和接口时,我认为应该将其重命名为您在上面看到的名称。这导致了这个错误,经过几天的研究和尝试后,我决定复制到原始文件中,并且成功了。这就是我所做的,复制文件并更新参考资料

我刚才遇到了同样的问题,经过一些调试,我找到了解决方案:

确保您只有一个
EnableJpaRepositories
注释,并且它指向实现类(而不是接口):

@EnableJpaRepositories(repositoryBaseClass=GenericJpaRepositoryImpl.class)


我希望这对将来的人有帮助;)

我刚才遇到了同样的问题,经过一些调试,我找到了解决方案:

确保您只有一个
EnableJpaRepositories
注释,并且它指向实现类(而不是接口):

@EnableJpaRepositories(repositoryBaseClass=GenericJpaRepositoryImpl.class)


我希望这对将来的人有帮助;)

我已经遇到了同样的问题,解决方案是为实现存储库创建正确的构造函数

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.querydsl.QueryDslPredicateExecutor;

import javax.persistence.EntityManager;

public interface RepositorySupport<T> extends JpaRepository<T, Integer>, QueryDslPredicateExecutor<T> {

    EntityManager getEntityManager();

}
public RepositorySupportImpl(JpaEntityInformation entityInformation,EntityManager EntityManager){
超级(实体信息、实体管理器);
}

希望这有帮助

我已经遇到了同样的问题,解决方案是为实现存储库创建正确的构造函数

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.querydsl.QueryDslPredicateExecutor;

import javax.persistence.EntityManager;

public interface RepositorySupport<T> extends JpaRepository<T, Integer>, QueryDslPredicateExecutor<T> {

    EntityManager getEntityManager();

}
public RepositorySupportImpl(JpaEntityInformation entityInformation,EntityManager EntityManager){
超级(实体信息、实体管理器);
}

希望这有帮助

您是否尝试在RepositorySupportImpl中添加所需的构造函数?是的,我让ide生成构造函数,但它没有创建此构造函数,而且我不确定“com.sun.proxy.$Proxy52”所期望的是什么。我认为根据该页面,您可能缺少springDataRepositoryInterface类。试着按照他们在那里做的事情告诉我们。我在上一次会议上遇到了同样的问题,你是否尝试在RepositorySupportImpl中添加它要求的必需构造函数?是的,我让ide生成了构造函数,但它没有创建这个构造函数,而且我不确定“com.sun.proxy.$Proxy52”所期望的是什么.我想根据那一页你可能会失踪
    public RepositorySupportImpl(JpaEntityInformation<T, ?> entityInformation, EntityManager entityManager) {
    super(entityInformation, entityManager);
}