use*_*307 7 spring-security spring-boot
我尝试在我的 java 应用程序中创建基本身份验证。对于他们,我在 gradle 文件中使用了这个依赖项
dependencies {
compile group: 'org.springframework.boot', name: 'spring-boot-starter', version: '1.5.9.RELEASE'
compile group: 'org.springframework.boot', name: 'spring-boot-starter-web', version: '1.5.9.RELEASE'
compile group: 'org.springframework.boot', name: 'spring-boot-starter-parent', version: '1.3.3.RELEASE'
compile group: 'org.springframework.boot', name: 'spring-boot-starter-security'
compile group: 'org.springframework.boot', name: 'spring-boot-starter-log4j2', version: '1.4.3.RELEASE'
compile group: 'org.springframework.boot', name: 'spring-boot-starter-data-mongodb', version: '1.5.9.RELEASE'
compile group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.7'
compile group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.7'
compile group: 'org.apache.logging.log4j', name: 'log4j-web', version: '2.7'
compile('org.hibernate:hibernate-core')
testCompile group: 'junit', name: 'junit', version: '4.12'
Run Code Online (Sandbox Code Playgroud)
}
当我实现扩展类 WebSecurityConfigurerAdapter 想法时显示错误无法解析符号 WebSecurityConfigurerAdapter并突出显示代码红色。

我也尝试使用下一个依赖项
compile group: 'org.springframework.boot', name: 'spring-security-core', version: '5.0.0.RELEASE'
compile group: 'org.springframework.boot', name: 'spring-security-web', version: '5.0.0.RELEASE'
compile group: 'org.springframework.boot', name: 'spring-security-config', version: '5.0.0.RELEASE'
Run Code Online (Sandbox Code Playgroud)
实现扩展类WebSecurityConfigurerAdapter需要哪些依赖文件?
该类将位于组中org.springframework.security,而不是工件下的org.springframework.bootspring-security-config
compile group: "org.springframework.security", name: "spring-security-config", version: "$springSecurityVersion"
Run Code Online (Sandbox Code Playgroud)
尽管,正如评论所暗示的那样,
示例 build.gradle 可能看起来像
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
}
apply plugin: "org.springframework.boot"
dependencies {
compile group: "org.springframework.security", name: "spring-security-core", version: "$springSecurityVersion"
compile group: "org.springframework.security", name: "spring-security-config", version: "$springSecurityVersion"
compile group: "org.springframework.security", name: "spring-security-web", version: "$springSecurityVersion"
compile group: "org.springframework.security", name: "spring-security-oauth2-jose", version: "$springSecurityVersion"
compile group: "org.springframework.security", name: "spring-security-oauth2-resource-server", version: "$springSecurityVersion"
compile group: "org.springframework.boot", name: "spring-boot-starter-web", version: "$springBootVersion"
compile group: "org.springframework.boot", name: "spring-boot-starter-security", version: "$springBootVersion"
compile group: "org.springframework.boot", name: "spring-boot-starter-thymeleaf", version: "$springBootVersion"
compile group: "org.thymeleaf.extras", name: "thymeleaf-extras-springsecurity5", version: "$thymeleafExtrasSpringSecurityVersion"
testCompile group: "org.springframework.boot", name: "spring-boot-starter-test", version: "$springBootVersion"
testCompile group: "org.springframework.security", name: "spring-security-test", version: "$springSecurityVersion"
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
28559 次 |
| 最近记录: |