spring - 如何在 IntelliJ 中使用 gradle 添加 spring-security-dependency?
问题描述
我想使用依赖项:
implementation 'org.springframework.boot:spring-boot-starter-security'
在我的 IntelliJ 项目中,但出于任何原因,它无法解决此依赖项。
这些是我的依赖项。相关的是spring-boot-starter-security
.
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-security'
developmentOnly 'org.springframework.boot:spring-boot-devtools'
runtimeOnly 'com.h2database:h2'
testImplementation('org.springframework.boot:spring-boot-starter-test') {
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
}
runtime('org.springframework.boot:spring-boot-devtools')
}
出于任何原因,我在启动引导运行时收到此错误消息:
这里是整个 build.gradle 文件:
plugins {
id 'org.springframework.boot' version '2.2.7.RELEASE'
id 'io.spring.dependency-management' version '1.0.9.RELEASE'
id 'java'
}
group = 'de.hohenheim'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '11'
configurations {
developmentOnly
runtimeClasspath {
extendsFrom developmentOnly
}
}
repositories {
mavenCentral()
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-security'
developmentOnly 'org.springframework.boot:spring-boot-devtools'
runtimeOnly 'com.h2database:h2'
testImplementation('org.springframework.boot:spring-boot-starter-test') {
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
}
runtime('org.springframework.boot:spring-boot-devtools')
}
test {
useJUnitPlatform()
}
bootRun {
sourceResources(sourceSets.main)
}
解决方案
推荐阅读
- networking - ntc-ansible 模块的 SSH 连接问题
- spring-boot - Spring Boot + Mustache:仅在用户通过身份验证时才呈现 html
- case - 案例语句重复行 - teradata
- javascript - 如何在javascript中延迟按钮的输出
- c# - 我该如何扭转这个?- “签名时出错:找不到SignTool.exe”
- python - 用 folium 绘制 netCDF 数据 - python
- android - 排除由 Realm 插件添加的 Gradle 依赖项
- rest - Xpages Domino Rest Services 错误,仅在特定环境中使用键调用 url
- python - 由于在 python 3 中,打印命令的结果不同
- javascript - 将函数变量传递给JavaScript中的另一个函数?