1. 2010-3-11 16:06:00 net.sf.ehcache.config.ConfigurationFactory parseConfiguration
  2. 警告: No configuration found. Configuring ehcache from ehcache-failsafe.xml  found in the classpath: jar:file:/E:/kenny/%e9%a1%b9%e7%9b%ae/shops/webapp/WEB-INF/lib/ehcache-1.6.1.jar!/ehcache-failsafe.xml
  3. 2010-03-11 16:06:02,734 [main] ERROR [org.springframework.test.context.TestContextManager] - Caught exception while allowing TestExecutionListener [org.springframework.test.context.support.DependencyInjectionTestExecutionListener@1292d12] to prepare test instance [com.zzh.entity.product.BrandServiceImplTest@4e32c8]
  4. org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.zzh.entity.product.BrandServiceImplTest': Autowiring of fields failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.zzh.service.product.impl.BrandServiceImpl com.zzh.entity.product.BrandServiceImplTest.brandServiceImpl; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'brandServiceImpl': Autowiring of fields failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.zzh.dao.product.BrandDao com.zzh.service.product.impl.BrandServiceImpl.brandDao; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [com.zzh.dao.product.BrandDao] is defined: Unsatisfied dependency of type [class com.zzh.dao.product.BrandDao]: expected at least 1 matching bean
  5. at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessAfterInstantiation(AutowiredAnnotationBeanPostProcessor.java:243)
  6. at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:959)
  7. at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireBeanProperties(AbstractAutowireCapableBeanFactory.java:329)
  8. at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:110)
  9. at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:75)
  10. at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:255)
  11. at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:111)
  12. at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.invokeTestMethod(SpringJUnit4ClassRunner.java:148)
  13. at org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:51)
  14. at org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:44)
  15. at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27)
  16. at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37)
  17. at org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42)
  18. at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:97)
  19. at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:46)
  20. at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
  21. at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
  22. at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
  23. at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
  24. at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
  25. Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.zzh.service.product.impl.BrandServiceImpl com.zzh.entity.product.BrandServiceImplTest.brandServiceImpl; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'brandServiceImpl': Autowiring of fields failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.zzh.dao.product.BrandDao com.zzh.service.product.impl.BrandServiceImpl.brandDao; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [com.zzh.dao.product.BrandDao] is defined: Unsatisfied dependency of type [class com.zzh.dao.product.BrandDao]: expected at least 1 matching bean
  26. at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:435)
  27. at org.springframework.beans.factory.annotation.InjectionMetadata.injectFields(InjectionMetadata.java:105)
  28. at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessAfterInstantiation(AutowiredAnnotationBeanPostProcessor.java:240)
  29. ... 19 more
  30. Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'brandServiceImpl': Autowiring of fields failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.zzh.dao.product.BrandDao com.zzh.service.product.impl.BrandServiceImpl.brandDao; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [com.zzh.dao.product.BrandDao] is defined: Unsatisfied dependency of type [class com.zzh.dao.product.BrandDao]: expected at least 1 matching bean
  31. at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessAfterInstantiation(AutowiredAnnotationBeanPostProcessor.java:243)
  32. at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:959)
  33. at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:472)
  34. at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
  35. at java.security.AccessController.doPrivileged(Native Method)
  36. at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
  37. at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
  38. at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
  39. at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
  40. at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
  41. at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
  42. at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:671)
  43. at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:610)
  44. at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:412)
  45. ... 21 more
  46. Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.zzh.dao.product.BrandDao com.zzh.service.product.impl.BrandServiceImpl.brandDao; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [com.zzh.dao.product.BrandDao] is defined: Unsatisfied dependency of type [class com.zzh.dao.product.BrandDao]: expected at least 1 matching bean
  47. at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:435)
  48. at org.springframework.beans.factory.annotation.InjectionMetadata.injectFields(InjectionMetadata.java:105)
  49. at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessAfterInstantiation(AutowiredAnnotationBeanPostProcessor.java:240)
  50. ... 34 more
  51. Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [com.zzh.dao.product.BrandDao] is defined: Unsatisfied dependency of type [class com.zzh.dao.product.BrandDao]: expected at least 1 matching bean
  52. at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:613)
  53. at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:412)
  54. ... 36 more

autowire异常主要由三个情况发生的

像上面的情况是BrandDao没有注入,

1。你的BrandServiceImpl必须以@Service或@Component注解才行。

2。自动写入的时候把接口写成实现类了 
@Autowired 
private BrandServiceImpl      brandServiceImpl; 
应该是 
@Autowired 
private BrandService    brandService ;

3.在BrandDao 类上加上@Repository注解

package com.biber.yxyz.service.impl.leave;

import oracle.sql.DATE;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.biber.yxyz.service.leave.TbLeaveRegisterServiceI;
import com.biber.yxyz.service.student.TbStudentServiceI;

import org.jeecgframework.core.common.service.impl.CommonServiceImpl;
import org.jeecgframework.web.system.service.SystemService;

import com.biber.yxyz.entity.leave.TbLeaveRegisterEntity;
import com.biber.yxyz.entity.student.TbStudentEntity;

import java.util.Date;
import java.util.List;
import java.util.UUID;
import java.io.Serializable;

@Service("tbLeaveRegisterService")
@Transactional
public class TbLeaveRegisterServiceImpl extends CommonServiceImpl implements TbLeaveRegisterServiceI {

@Autowired
private SystemService systemService;

//@autowired(如果你不小心在这里加了这个,会出现autowired异常,因为这个类已经存在了 不需要注入)

private TbLeaveRegisterServiceI tbLeaveRegisterService;
@Autowired
private TbStudentServiceI tbStudentService;

public <T> void delete(T entity) {
super.delete(entity);
//执行删除操作配置的sql增强
this.doDelSql((TbLeaveRegisterEntity)entity);
}

public <T> Serializable save(T entity) {
Serializable t = super.save(entity);
//执行新增操作配置的sql增强
this.doAddSql((TbLeaveRegisterEntity)entity);
return t;
}

public <T> void saveOrUpdate(T entity) {
super.saveOrUpdate(entity);
//执行更新操作配置的sql增强
this.doUpdateSql((TbLeaveRegisterEntity)entity);
}

/**
* 默认按钮-sql增强-新增操作
* @param id
* @return
*/
public boolean doAddSql(TbLeaveRegisterEntity t){
return true;
}
/**
* 默认按钮-sql增强-更新操作
* @param id
* @return
*/
public boolean doUpdateSql(TbLeaveRegisterEntity t){
return true;
}
/**
* 默认按钮-sql增强-删除操作
* @param id
* @return
*/
public boolean doDelSql(TbLeaveRegisterEntity t){
return true;
}
/**
* 生成迟到信息
* @param
* @return
*/
public void beforeCount(){
List<TbLeaveRegisterEntity> tList=systemService.findByProperty(TbLeaveRegisterEntity.class, "type", "1");
Date date=new Date();
for(TbLeaveRegisterEntity a:tList){
if(date.after(a.getEndtime())){
a.setType("0");
tbLeaveRegisterService.saveOrUpdate(a);
TbStudentEntity tS=systemService.getEntity(TbStudentEntity.class, a.getStudent().getId());
tS.setMatter("0");
tS.setLeave(null);
tbStudentService.saveOrUpdate(tS);
}
}

}
/**
* 针对考勤报表时间内的处理
* @param
* @return
*/
public void afterCount(){
List<TbLeaveRegisterEntity> tList=systemService.findByProperty(TbLeaveRegisterEntity.class, "type", "1");
Date date=new Date();
for(TbLeaveRegisterEntity a:tList){
if(date.before(a.getEndtime())&&date.after(a.getCreatetime())){
a.setType("8");
tbLeaveRegisterService.saveOrUpdate(a);
TbStudentEntity tS=systemService.getEntity(TbStudentEntity.class, a.getStudent().getId());
tS.setMatter("1");
tbStudentService.saveOrUpdate(tS);
}
}

}
/**
* 替换sql中的变量
* @param sql
* @return
*/
public String replaceVal(String sql,TbLeaveRegisterEntity t){
sql = sql.replace("#{id}",String.valueOf(t.getId()));
sql = sql.replace("#{begintime}",String.valueOf(t.getBegintime()));
sql = sql.replace("#{endtime}",String.valueOf(t.getEndtime()));
sql = sql.replace("#{type}",String.valueOf(t.getType()));
sql = sql.replace("#{earlyafter}",String.valueOf(t.getEarlyafter()));
// sql = sql.replace("#{departid}",String.valueOf(t.getDepart().getId()));
//sql = sql.replace("#{studentid}",String.valueOf(t.getStudent().getId()));
sql = sql.replace("#{createtime}",String.valueOf(t.getCreatetime()));
sql = sql.replace("#{updatetime}",String.valueOf(t.getUpdatetime()));
sql = sql.replace("#{status}",String.valueOf(t.getStatus()));
sql = sql.replace("#{createuser}",String.valueOf(t.getCreateuser()));
sql = sql.replace("#{shuoming}",String.valueOf(t.getShuoming()));
sql = sql.replace("#{name}",String.valueOf(t.getName()));
sql = sql.replace("#{banji}",String.valueOf(t.getBanji()));
sql = sql.replace("#{UUID}",UUID.randomUUID().toString());
return sql;
}
}

autowire异常的三个情况的更多相关文章

  1. Tomcat内存溢出的三种情况及解决办法分析

    Tomcat内存溢出的原因 在生产环境中tomcat内存设置不好很容易出现内存溢出.造成内存溢出是不一样的,当然处理方式也不一样. 这里根据平时遇到的情况和相关资料进行一个总结.常见的一般会有下面三种 ...

  2. 对象的notify方法的含义和对象锁释放的三种情况

    1,notify的含义     (1)notify一次只随机通知一个线程进行唤醒 (2)在执行了notify方法之后,当前线程不会马上释放该对象锁,呈wait状态的线程也不能马上获得该对象锁, 要等到 ...

  3. TI C66x DSP 系统events及其应用 - 5.10(创建ISR的三种情况)

    ISFP是服务中断的指令包,创建ISR的三种情况: 1.一个ISFP包的8条指令就能够满足ISR watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQveWl5ZW ...

  4. SSO单点登录三种情况的实现方式详解

    单点登录(SSO——Single Sign On)对于我们来说已经不陌生了.对于大型系统来说使用单点登录可以减少用户很多的麻烦.就拿百度来说吧,百度下面有很多的子系统——百度经验.百度知道.百度文库等 ...

  5. .net webapi 接收 xml 格式数据的三种情况

    webapi 接收 xml 的三种方法 前段时间接到一个任务写一个小接口,要接收java端返回过来的短信xml数据. 刚拿到项目,我的第一想法是对方会以什么形式发送xml格式的数据给我呢,设想三种情况 ...

  6. Spring如何使用JdbcTemplate调用存储过程的三种情况

    注:原文 <Spring如何使用JdbcTemplate调用存储过程的三种情况 > Spring的SimpleJdbcTemplate将存储过程的调用进行了良好的封装,下面列出使用Jdbc ...

  7. DG备库,实时应用如何判断,MR进程,及MRP应用归档,三种情况的查询及验证

    本篇文档学习,DG备库,实时应用如何判断,MR进程,及MRP应用归档,三种情况的查询及验证 1.取消MRP进程 备库查询进程状态select process,client_process,sequen ...

  8. SSO单点登录三种情况的实现方式详解(转载)

    单点登录(SSO——Single Sign On)对于我们来说已经不陌生了.对于大型系统来说使用单点登录可以减少用户很多的麻烦.就拿百度来说吧,百度下面有很多的子系统——百度经验.百度知道.百度文库等 ...

  9. “全栈2019”Java异常第三章:try代码块作用域详解

    难度 初级 学习时间 10分钟 适合人群 零基础 开发语言 Java 开发环境 JDK v11 IntelliJ IDEA v2018.3 文章原文链接 "全栈2019"Java异 ...

随机推荐

  1. python reduce()函数

    reduce()函数 reduce()函数也是Python内置的一个高阶函数.reduce()函数接收的参数和 map()类似,一个函数 f,一个list,但行为和 map()不同,reduce()传 ...

  2. 参加 TiD 2015 是怎样一番体验?

    人生有很多第一次,(专程打飞的去帝都)参加软件大会,我也是第一次.   TiD   说到软件大会,QCon.PyCon 什么的早已如雷贯耳,没吃过猪肉还没见过猪跑?但对于 TiD,确实还是头一次听说. ...

  3. javascript优化--05模式(函数)

    回调函数模式: 基本例子: var findNodes = function (callback) { ...................... if (typeof callback !== ' ...

  4. [LintCode] Trapping Rain Water

    Given n non-negative integers representing an elevation map where the width of each bar is 1, comput ...

  5. EntityFramework 6.0< Code First > 连接 Mysql数据库

    网上有很多关于用EntityFrame来连接Mysql数据库的教程,可是很多并不靠谱,转载的太多了.找了很久,总算是配置好了,现在分享一下. 一,安装:     1.开发环境: VS2013与EF6 ...

  6. HDU4859 海岸线(最小割)

    题目大概就是说一个n*m的地图,地图上每一块是陆地或浅海域或深海域,可以填充若干个浅海域使其变为陆地,问能得到的最长的陆地海岸线是多少. 也是很有意思的一道题. 一开始想歪了,想着,不考虑海岸线重合的 ...

  7. SPOJ371 Boxes(最小费用最大流)

    把球当作水. #include<cstdio> #include<cstring> #include<queue> #include<algorithm> ...

  8. LightOJ1064 Throwing Dice(DP)

    第一眼以为是概率DP,我还不会.不过看题目那么短就读读,其实这应该还不是概率DP,只是个水水的DP.. dp[n][s]表示掷n次骰子点数和为s的情况数 dp[0][0]=1 dp[i][j]=∑dp ...

  9. BZOJ1767 : [Ceoi2009]harbingers

    设d[i]表示i到1的距离 f[i]=w[i]+min(f[j]+(d[i]-d[j])*v[i])=w[i]+d[i]*v[i]+min(-d[j]*v[i]+f[j]) 对这棵树进行点分治,每次递 ...

  10. 【POJ】1743 Musical Theme

    http://poj.org/problem?id=1743 题意:不可重叠最长重复子串,n<=20000,具体看<后缀数组>-- 罗穗骞 #include <cstdio&g ...