springboot profile configuration tools to obtain information

 When the package information acquiring tools properties profile, the method to the point SET static modification, shortcut keys have generated static modification.

@Component
public class EnPwdUtil {

    
    private static String username;

    private static String pwd;

    public static String getUsername() {
        return username;
    }

    @Value("${hngp.username}")//注意set方法没有static修饰
    public void setUsername(String username) {
        EnPwdUtil.username = username;
    }

    public static String getPwd() {
        return pwd;
    }

    @Value("${hngp.pwd}")
    public  void setPwd(String pwd) {

        EnPwdUtil.pwd = pwd;
        System.out.println("pwd"+pwd);
    }

    public static String enPwd(){

        System.out.println(username+"------"+pwd);
        return new Md5Hash(pwd, username, 2).toHex().toString();
    }

}

 

Published 39 original articles · won praise 6 · views 30000 +

Guess you like

Origin blog.csdn.net/qq_40155654/article/details/100518248