如何使用java ee 6 @Resource注释 [英] How to use java ee 6 @Resource annotation

查看:143
本文介绍了如何使用java ee 6 @Resource注释的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

java ee 6 api有一个注释 @但是,具有属性'lookup'的资源,java se 6 api也是如此(这里)。但是,由于java ee 6依赖于java se 6,看起来你无法获得注释的ee版本和'lookup'属性。

The java ee 6 api has an annotation @Resource with an attribute 'lookup', however, so does the java se 6 api (here). However, since java ee 6 is dependent on java se 6, it seems you can not get at the ee version of the annotation and the 'lookup' attribute.

这是一个错误还是有其他方法可以使用我缺少的这个注释。

Is this a bug or is there some other way to use this annotation that I am missing.

TIA

推荐答案

你的JDK(和我的)没有从 javax.annotation.Resource = noreferrer> JSR-250 。要在编译期间使用最新版本,您必须覆盖编译器的支持目录(例如,指向您的glassfishv3支持目录):

Your JDK (and mine) doesn't have the latest version of the javax.annotation.Resource from the JSR-250. To use the latest version during compilation, you'll have to override the compiler's endorsed directory (e.g. to point to your glassfishv3 endorsed directory):

-Djava.endorsed.dirs=${GLASSFISH_HOME}/modules/endorsed

这篇关于如何使用java ee 6 @Resource注释的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆