我见过Maven cannot compile Spring Security demo project。但是我的问题没有解决。
下面的代码中出现了问题:
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-core</artifactId>
<version>5.0.6.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<version>5.0.6.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<version>5.0.6.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-taglibs</artifactId>
<version>5.0.6.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-framework-bom</artifactId>
<version>5.0.7.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
java代码(导入):
import org.springframework.security.authentication.encoding.Md5PasswordEncoder;
import org.springframework.security.authentication.encoding.ShaPasswordEncoder;
在mvn compile
中运行:
package org.springframework.security.authentication.encoding does not exist
答案 0 :(得分:1)
已弃用。您可以尝试更换:
org.springframework.security.crypto.password.MessageDigestPasswordEncoder
答案 1 :(得分:1)
org.springframework.security.crypto.password.MessageDigestPasswordEncoder 也已弃用,因此我们可以使用org.springframework.security.crypto.password.DelegatingPasswordEncoder 默认情况下,它可以用于不同类型的算法,它使用bcrypt,但支持ldap,MD4,MD5,noop,pbkdf2,scrypt,SHA-1,SHA-256,sha256。