启动类中用@value获取配置信息

private static String newone;
@Value("${newone}")
public void setNewone(String value) {
    newone = value;
}
main方法
SpringApplication.run(GatewayApplication.class, args);
System.out.println("启动成功");
System.out.println("newone="+newone);

本文由 hcb 创作,采用 知识共享署名 3.0,可自由转载、引用,但需署名作者且注明文章出处。

还不快抢沙发

添加新评论