项目结构如图,auth是权鉴相关的包,无启动类,配置文件在user模块中
1、使用了compent注解
2、被注入的是静态属性,是通过set方式注入
@Component
public class JwtUtil {
/**
* JWT认证加密私钥(Base64加密)
*/
private static String encryptJwtKey;
@Value("${config.encrypt-jwtKey}")
public void setEncryptJwtKey(String encryptJwtKey) {
JwtUtil.encryptJwtKey = encryptJwtKey;
}