----------------------------------application-jwt.properties------------------------
c.jwt.toke.secret=xxx c.jwt.toke.issuer=xxx c.jwt.toke.userno=xx c.jwt.toke.date=ss
----------------------------------JwtProConfig,java---------------------------------
import javax.annotation.PostConstruct; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.PropertySource; @Configuration @PropertySource({"classpath:application-jwt.properties"}) @ConfigurationProperties(prefix = "c.jwt.toke") public class JwtProConfig { public static String TOKEN_SECRET; public static String ISSUER; public static String USERNO; public static Long DATE;// = 1L; //10秒钟 public String secret; public String issuer; public String userno; public Long date; //这个一定要加 @PostConstruct public void JwtProConfigValue() { TOKEN_SECRET = this.secret; ISSUER = this.issuer; USERNO = this.userno; //DATE = Long.valueOf(this.date); DATE = this.date; } public String getSecret() { return secret; } public void setSecret(String secret) { this.secret = secret; } public String getIssuer() { return issuer; } public void setIssuer(String issuer) { this.issuer = issuer; } public String getUserno() { return userno; } public void setUserno(String userno) { this.userno = userno; } public Long getDate() { return date; } public void setDate(Long date) { this.date = date; } }
----------------------------------最后直 接类.静态属性 -------------------------------