org.springframework.web.context.ContextLoader:307项目编译后无法启动总是报错

org.springframework.web.context.ContextLoader:307 - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'computationService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.ekyb.common.arithmetic.service.ArithmeticService com.ekyb.common.arithmetic.service.impl.ComputationServiceImpl.arithmeticService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'arithmeticServiceImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private net.sf.ehcache.Cache com.ekyb.common.arithmetic.service.impl.ArithmeticServiceImpl.cache; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [net.sf.ehcache.Cache] 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:287)

百度了半天都说是自家项目spring3.1.0和jdk1.8版本不对付,但是换成jdk1.7之后仍然报错,继续整理

整理发现自家项目本地的mq不起也会报这个错,因为在mac系统安装和启动mq后仍报错,以为是项目连接不到mq地址,在项目中ping tcp地址没有问题。

最后研究项目自身问题发现computationService下Cache注入上

@org.springframework.beans.factory.annotation.Autowired(required=true)

true改成false

在编译项目启动没有问题了,

但是此项为true时在Windows系统下可以正常启动,在mac环境下却不可以。

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值