spring

1.maven install的时候:
No compiler is provided in this environment. perhaps you are running on a jre rather than a jdk?
window->perference->java->Installed JREs->把jre换成jdk

2.maven install的时候,程序包org.junit不存在
我是在pom.xml里把

<dependency>
    <groupId>junit</groupId>
    <artifactId>junit</artifactId>
    <version>3.8.1</version>
    <scope>test</scope>(这里注释掉,maven install就可以了)
</dependency>
  1. junit failed to load applicationcontext
    解决:
    把@ContextConfiguration(locations = {“classpath:applicationContext.xml”})
    改为
    @ContextConfiguration(locations = {“classpath:*.xml”})

4.Error creating bean with name ‘xxx.xx.xx.xxx’: Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private xxx.yy.zz.xxService….NoSuchBeanDefinitionException:No qualifying beanof type [xx.xxservice] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency.
解决:mapping.xml里用到了一个VO对象没有定义(mapping.xml是从其他地方拷过来的)

第二天,又写了个Dao
测试的时候报错:

Error creating bean with name 'xxx':Injection of resource...,...must be of type ...,but was actually of type [com.sun.proxy.$Proxy25]
莫名其妙啊,service上漏加@Service注解了,test里@resource下面的对象申明改了一下,
本来是
@Resource 
private RFUpdDao rFDao;
现在改成:
private RFUpdDao rFUpdDao;
是不是测试案例里不能申明相同的对象。
阅读更多
个人分类: java
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭
关闭