缺少类Spring Security

时间:2017-10-06 10:55:17

标签: java spring maven spring-security

这是我的POM.xml

...

  <properties>
    <spring.webflow.version>2.3.3.RELEASE</spring.webflow.version>
  </properties>

  <dependencies>


...
        <dependency>
            <groupId>org.springframework.security.extensions</groupId>
            <artifactId>spring-security-saml2-core</artifactId>
            <version>1.0.2.RELEASE</version>
        </dependency>
<dependency>
    <groupId>org.springframework.security</groupId>
    <artifactId>spring-security-core</artifactId>
    <version>4.2.3.RELEASE</version>
</dependency>
<dependency>
    <groupId>org.springframework.security</groupId>
    <artifactId>spring-security-config</artifactId>
    <version>4.2.3.RELEASE</version>
</dependency>
    <dependency>
      <groupId>org.springframework.webflow</groupId>
      <artifactId>spring-faces</artifactId>
      <version>${spring.webflow.version}</version>
      <exclusions>
        <exclusion>
          <groupId>commons-logging</groupId>
          <artifactId>commons-logging</artifactId>
        </exclusion>
      </exclusions>
    </dependency>


...

  <repositories>

   <repository>

      <id>spring-snapshots</id>

      <name>Spring Snapshots</name>

      <url>https://repo.spring.io/libs-milestone</url>

   </repository>
...
</project>

错误是:

WebSecurityConfigurerAdapter cannot be resolved to a type
EnableWebSecurity cannot be resolved to a type (Annotation)
...

这些应该在包中: org.springframework.security.config.annotation.web.configuration

我已经完成了mvn clean install -U,但这并没有解决问题。如果我遗漏了某些依赖关系或这些依赖关系之间的任何不兼容性,那么有什么想法吗?

我发现了一个奇怪的场景:

将这些依赖项添加到我的pom中后,我无法在我的eclipse项目中看到它们&gt; Maven Dependencies?!

敬意,

1 个答案:

答案 0 :(得分:1)

  

缺少类Spring Security

这两个依赖用于Spring security

<!-- Spring security -->
<dependency>
     <groupId>org.springframework.security</groupId>
     <artifactId>spring-security-web</artifactId>
     <version>4.2.3.RELEASE</version>
</dependency>
<dependency>
     <groupId>org.springframework.security</groupId>
     <artifactId>spring-security-config</artifactId>
     <version>4.2.3.RELEASE</version>    
</dependency>