有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

雅加达ee如何使用JavaEE6@Resource注释

然而,JavaEE6API有一个带有属性“lookup”的注释@Resource,JavaSE6API(here)也是如此。然而,由于JavaEE6依赖于JavaSE6,因此您似乎无法获得注释的ee版本和“lookup”属性

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

蒂亚


共 (1) 个答案

  1. # 1 楼答案

    Thread necro处于最佳状态,但就我的口味而言,javamonkey79的方法实在是太老套了

    这是我放在pom里的。xml使其工作:

    <profiles>
            <profile>
                <id>endorsed</id>
                <activation>
                    <property>
                        <name>sun.boot.class.path</name>
                    </property>
                </activation>
                <build>
                    <plugins>
                        <plugin>
                            <groupId>org.apache.maven.plugins</groupId>
                            <artifactId>maven-compiler-plugin</artifactId>
                            <configuration>
                                <!  javaee6 contains upgrades of APIs contained within the JDK itself.
                                     As such these need to be placed on the bootclasspath, rather than classpath of the
                                     compiler.
                                     If you don't make use of these new updated API, you can delete the profile.
                                     On non-SUN jdk, you will need to create a similar profile for your jdk, with the similar property as sun.boot.class.path in Sun's JDK. >
                                <compilerArguments>
                                    <bootclasspath>${settings.localRepository}/javax/javaee-endorsed-api/6.0/javaee-endorsed-api-6.0.jar${path.separator}${sun.boot.class.path}</bootclasspath>
                                </compilerArguments>
                            </configuration>
                            <dependencies>
                                <dependency>
                                    <groupId>javax</groupId>
                                    <artifactId>javaee-endorsed-api</artifactId>
                                    <version>6.0</version>
                                </dependency>
                            </dependencies>
                        </plugin>
                    </plugins>
                </build>
            </profile>
        </profiles>
    

    顺便说一下,我找到了这个here。非常感谢,弗雷德里克