首页 > 编程语言 > 详细

java.lang.IllegalArgumentException: template not initialized; call afterPropertiesSet() before using

时间:2016-11-02 17:53:29      阅读:3374      评论:0      收藏:0      [点我收藏+]

在使用spring-data-redis时使用junit测试报错:
  java.lang.IllegalArgumentException: template not initialized; call afterPropertiesSet() before using

 

通过跟踪代码发现是这一句出了问题:

Assert.isTrue(this.initialized, "template not initialized; call afterPropertiesSet() before using it");

而initialized是在public void afterPropertiesSet() 中被赋值为true的。


解决方式:
不能直接在代码中用new来直接实例化,必须得用SpingBean的实例化方式来!

java.lang.IllegalArgumentException: template not initialized; call afterPropertiesSet() before using

原文:http://www.cnblogs.com/xuxu-dragon/p/6023522.html

(1)
(2)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!