首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >springframework.security包没有找到启动器-安全性依赖?

springframework.security包没有找到启动器-安全性依赖?
EN

Stack Overflow用户
提问于 2015-10-29 14:15:19
回答 1查看 4.4K关注 0票数 6

对于我的项目,我使用spring引导和spring依赖项。我尝试在Gradle中使用spring安全性依赖项,但在项目中没有找到安全包。艾德是IntelliJ IDEA‎。

我的build.gradle文件:

代码语言:javascript
复制
buildscript {
    ext {
        springBootVersion = '1.2.7.RELEASE'
    }
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}") 
        classpath('io.spring.gradle:dependency-management-plugin:0.5.2.RELEASE')
        classpath("org.springframework:springloaded:1.2.4.RELEASE")
    }
}

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'spring-boot' 
apply plugin: 'io.spring.dependency-management' 

jar {
    baseName = 'hashfon-spring'
    version = '0.0.1-SNAPSHOT'
}
sourceCompatibility = 1.8
targetCompatibility = 1.8

repositories {
    mavenCentral()
}


dependencies {
    compile('org.springframework.boot:spring-boot-starter-data-jpa')
    compile('org.springframework.boot:spring-boot-starter-data-rest')
    compile('org.springframework.boot:spring-boot-starter-hateoas')
    compile('org.springframework.boot:spring-boot-starter-jersey')
    compile('org.springframework.boot:spring-boot-starter-mustache')
    compile('org.springframework.boot:spring-boot-starter-thymeleaf')
    compile('org.springframework.boot:spring-boot-starter-web')
    compile('org.springframework.boot:spring-boot-starter-security')

    runtime('mysql:mysql-connector-java')
    testCompile('org.springframework.boot:spring-boot-starter-test') 
}

除安全性外,所有库都可以在外部库中找到。

在项目中有一个类的例子:

代码语言:javascript
复制
import org.springframework.context.annotation.Configuration;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.*;
import org.springframework.hateoas.*;
import org.springframework.mock.*;
import org.springframework.data.*;
import org.springframework.security.*;  //cannot resolve symbol!
/**
 * I can import all packages from external libraries except security
 */

PS。我尝试了很多不同版本的spring安全核心,但什么都没发生。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-04-28 12:49:39

在多次处理这个问题之后,我发现了以下解决方案,对我来说是有效的:

  1. 转到File _File无效缓存
  2. 删除存储所有依赖项的文件夹(~/..gradle/,用于UNIX系统)--如果它在失效后存在
  3. 重启Intellij IDEA
  4. 通过刷新gradle重新导入gradle依赖关系:

票数 8
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/33416667

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档