zoukankan      html  css  js  c++  java
  • spring读取properties文件配置使用

    spring框架通过配置读取properties属性文件信息

    在spring-applicationContext.xml文件中配置

    <bean id="propertyConfigurerForEnv"
            class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
            <property name="locations">
                <list>
                    <value>file:/data/cnc/conf/*.properties</value>
                </list>
            </property>
        </bean>

    这里的locations属性是一个集合,所以配置的时候可以配置多个,在java文件中可以使用@Value注解来获取属性文件中的数据

    @Value("${t1.msgname}")

  • 相关阅读:
    小节 +三元表达式
    continue
    break
    flag标签
    #region #endregion
    for 循环
    do while 有例句体会循环的真正原理
    while 循环
    前缀和与差分
    递归的循环实现
  • 原文地址:https://www.cnblogs.com/snail-zhe/p/6439577.html
Copyright © 2011-2022 走看看