资源注入类型不匹配

时间:2014-11-24 08:59:16

标签: java resources code-injection

以下代码返回Type mismatch:无法从String转换为Class

import javax.annotation.Resource;
import javax.jms.ConnectionFactory;
import javax.jms.Queue;


public class JmsMessageCollector {

    @Resource(name="My_connFactory",type="javax.jms.ConnectionFactory") 
    private static ConnectionFactory connectionFactory;

}

我该如何解决这个问题?

1 个答案:

答案 0 :(得分:1)

@Resource(name="WIAM_connFactory", type=javax.jms.ConnectionFactory.class)  

根据错误消息和javadoc