项目中,Spring注入问题
严重: Exception sending context initialized event to listener instance of class
org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'cn.qingyou.elec.dao.impl.DeviceDaoImpl':
这是什么情况。
public interface DeviceDao extends BaseDao<Device> {
public final static String SERVICE_NAME="cn.qingyou.elec.dao.impl.DeviceDaoImpl";
}
@Repository(DeviceDao.SERVICE_NAME)
public class DeviceDaoImpl extends BaseDaoImpl<Device> implements DeviceDao {
}
------解决方案--------------------查一下你的 package 里有没有这个 class:
cn.qingyou.elec.dao.impl.DeviceDaoImpl
------解决方案--------------------slf4j.jar没有这个jar包吗
------解决方案--------------------
你问题的直接原因应该是这个IllegalAccessError。
org.slf4j.impl.StaticLoggerBinder.SINGLETON 的访问,在旧版本中是允许的,但是在新版(大概是1.5.6及以后),变为 private 了。
猜测有可能的情况是,你的 slf4j 的版本有问题。大概是slf4j-api用的是旧版,而slf4j的implementation用的是新版。
统一用新版(当然了,统一用旧版,也行),应能解决问题。