相关疑难解决方法(0)

获取Spring错误"Bean命名为'x'必须是[y]类型,但实际上是Jenkins类型[$ Proxy]"

我现在已经调试了一段时间了,我希望有人能在这里说清楚.

我有一个使用JDK 1.6添加到Jenkins的Maven项目.我在这个项目中使用AOP来处理数据库事务.

当我在Jenkins中运行构建时,我的测试用例失败,但有以下例外: -

Caused by: org.springframework.beans.factory.BeanCreationException: 
Error creating bean with name 'dataHandlerClassificationImpl': 
Injection of resource dependencies failed; nested exception is 
org.springframework.beans.factory.BeanNotOfRequiredTypeException: 
Bean named 'writerDataLocationImpl' must be of type [xxx.script.WriterData], 
but was actually of type [$Proxy17]
    ...
    ...
Caused by: org.springframework.beans.factory.BeanNotOfRequiredTypeException: 
Bean named 'writerDataLocationImpl' must be of type [xxx.script.WriterData], 
but was actually of type [$Proxy17]
    ...
    ...
Run Code Online (Sandbox Code Playgroud)

DataHandlerClassificationImpl课程看起来像这样: -

@Service
public class DataHandlerClassificationImpl extends DataHandler {

    @Resource(name="writerDataLocationImpl")
    private WriterData writerData;

    ...
}       
Run Code Online (Sandbox Code Playgroud)

WriterData 是一个具有多个实现的接口.

我能够在没有问题的情况下从IDE执行代码.为了确定它是Maven问题还是Jenkins问题,我使用命令行导航到Jenkins的项目作业文件夹,我能够毫无错误地运行mvn test …

junit spring unit-testing hudson jenkins

19
推荐指数
1
解决办法
2万
查看次数

标签 统计

hudson ×1

jenkins ×1

junit ×1

spring ×1

unit-testing ×1