java-springframework.security包找不到与starter-security依赖关系?
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了java-springframework.security包找不到与starter-security依赖关系?,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含2130字,纯文字阅读大概需要4分钟。
内容图文
我正在为我的项目使用spring boot和spring starter依赖项.
我尝试使用Gradle中的spring starter安全依赖项,但在项目中找不到安全包. IDE是IntelliJ IDEA.
我的build.gradle文件:
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')
}
除安全性之外的所有库都可以在外部库中找到…
项目中的一个类示例:
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-security-core,没有任何反应.
解决方法:
多次处理这个问题后,我遇到了以下解决方案,这对我100%有效:
>转到文件|使缓存无效
>删除存储所有依赖项的文件夹(?/ .gradle /对于UNIX系统) – 如果在失效后存在
>重启Intellij IDEA
>通过刷新gradle重新导入gradle依赖项:
内容总结
以上是互联网集市为您收集整理的java-springframework.security包找不到与starter-security依赖关系?全部内容,希望文章能够帮你解决java-springframework.security包找不到与starter-security依赖关系?所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。