zoukankan      html  css  js  c++  java
  • spring占位符解析器---PropertyPlaceholderHelper

    一、PropertyPlaceholderHelper 职责

      扮演者占位符解析器的角色,专门用来负责解析路劲中or名字中的占位符的字符,并替换上具体的值

    二、例子

    public class PropertyPlaceholderHelperDemo {
    
        @SuppressWarnings("resource")
        public static void main(String[] args) {
            Properties properties = System.getProperties();
            
            properties.setProperty("prefixName", "read-code");
            
            ApplicationContext ac = new ClassPathXmlApplicationContext("classpath:${prefixName}-spring.xml");
            
            ReadCodeService readCodeService = (ReadCodeService) ac.getBean("readCodeService");
            
            readCodeService.say();
        }
    }

    你可以debug进去,看下源码。底层PropertyPlaceholderHelper会去解析替换占位符value。

  • 相关阅读:
    QT中的列表容器
    QT中的Buttons
    QT中的常用控件
    [机房测试]弟娃
    CF1580C Train Maintenance
    [机房测试]数据恢复
    Sentry 监控
    Sentry 监控
    Sentry 监控
    Sentry 后端监控
  • 原文地址:https://www.cnblogs.com/chenmo-xpw/p/5575359.html
Copyright © 2011-2022 走看看