在JSF + Spring 3 WebApplication中找不到javax.annotation.security.RolesAllowed

时间:2012-10-04 08:16:00

标签: jsf spring-security

我正在尝试将Spring 3.1.2 Security添加到现有的JSF应用程序中,问题是无法找到此注释,我不知道那里缺少哪个依赖项。任何帮助表示赞赏:

的pom.xml

<properties>
    <myfaces.version>2.1.8</myfaces.version>
    <spring-security.version>3.1.2.RELEASE</spring-security.version>
</properties>

        <!-- Spring Security -->
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-core</artifactId>
            <version>${spring-security.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-config</artifactId>
            <version>${spring-security.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-acl</artifactId>
            <version>${spring-security.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-web</artifactId>
            <version>${spring-security.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-taglibs</artifactId>
            <version>${spring-security.version}</version>
        </dependency>   

1 个答案:

答案 0 :(得分:0)

您没有提到要部署的应用服务器,所以我假设Tomcat通常不具备所有/ Java EE依赖性。如果您只是在寻找注释,那么您只需获取JSR250 API依赖项:

<dependency>
    <groupId>javax.annotation</groupId>
    <artifactId>jsr250-api</artifactId>
    <version>1.0</version>
</dependency>

您还可以引入完整的Java EE 6 API:

<dependency>
    <groupId>javax</groupId>
    <artifactId>javaee-api</artifactId>
    <version>6.0</version>
</dependency>