V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
liugang0503
V2EX  ›  问与答

properties 文件中定义了个常量,其它的属性也引用到了这个常量,后台 Java 代码获取属性值不对,该如何解析呢?

  •  
  •   liugang0503 · 2018-09-07 10:23:32 +08:00 · 812 次点击
    这是一个创建于 2108 天前的主题,其中的信息可能已经有所发展或是发生改变。

    形如: URL_PREFIX=http://127.0.0.1:9001 CALL_URL=${URL_PREFIX}/aa/bb.do

    后台解析的还是 ${URL_PREFIX}/aa/bb.do 这样,占位符中的内容没有替换。

    后台解析主要代码: private static Properties props ; public ConfigProperties(){ try { Resource resource = new ClassPathResource("/interface.properties"); props = PropertiesLoaderUtils.loadProperties(resource); } catch (IOException e) { e.printStackTrace(); } }

    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2203 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 39ms · UTC 01:51 · PVG 09:51 · LAX 18:51 · JFK 21:51
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.