paker1989
paker1989
采纳率0%
2017-01-05 07:29 阅读 1.9k

dubbo spring boot spring-data-jpa报错

10

当有多个service实现类注入同一个Repository时,就报下面的错:

 Caused by: java.lang.IllegalArgumentException: Repository interface must not be null on initialization!
    at org.springframework.util.Assert.notNull(Assert.java:115) ~[spring-core-4.3.2.RELEASE.jar:4.3.2.RELEASE]
    at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.initAndReturn(RepositoryFactoryBeanSupport.java:263) ~[spring-data-commons-1.12.2.RELEASE.jar:na]
    at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.getObject(RepositoryFactoryBeanSupport.java:213) ~[spring-data-commons-1.12.2.RELEASE.jar:na]
    at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.getObject(RepositoryFactoryBeanSupport.java:50) ~[spring-data-commons-1.12.2.RELEASE.jar:na]
    at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:168) ~[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE]
    ... 255 common frames omitted

1、可以正常启动的情况

 @Service(version = "1.0.0")
public class EmployeeAccountServiceImpl implements EmployeeAccountService {
    @Autowired
    EmployeeRepository employeeRepository;

2、不能正常启动的情况

 @Service(value = "employeeAccountService")
//@Service(version = "1.0.0")
public class EmployeeAccountServiceImpl implements EmployeeAccountService {
    @Autowired
    EmployeeRepository employeeRepository;
 <dubbo:service  interface="com.xxx.service.employee.EmployeeAccountService" ref="employeeAccountService" version="1.0.0" validation="true"/>
  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

2条回答 默认 最新

  • sun1021873926 夕阳雨晴 2017-01-05 07:39

    把你关于jpa接口相关的代码贴出来呀

    点赞 评论 复制链接分享
  • u012253957 crsfyc 2017-01-05 08:40

    你看下注解@Service使用的是spring的还是dubbo的注解,两者好像有细微的区别

    点赞 评论 复制链接分享

相关推荐