启动类中用@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,可自由转载、引用,但需署名作者且注明文章出处。

只有地板了

  1. uedvzrhxml
    uedvzrhxml

    探秘传奇私服妖兽大陆,怪物挑战等你来战,赢取独家福利!:https://501h.com/yuanshi/2024-11-05/46447.html

添加新评论