zoukankan      html  css  js  c++  java
  • context:property-placeholder作用

    原文地址:http://blog.sina.com.cn/s/blog_a0de59cf0101dqeb.html

    spring去加载,这个元素的写法如下:

    <context:property-placeholder location="classpath:jdbc.properties"/>

    如果想要配置多个properties文件

    <context:property-placeholder location="classpath:jdbc.properties"/>

    <context:property-placeholder location="classpath:jdbc.properties"/>

    这种方式是不被允许的,一定会出"Could not resolve placeholder"

    解决方案:

    (1) Spring 3.0中,可以写:

    <context:property-placeholder location="xxx.properties" ignore-unresolvable="true"/>

    <context:property-placeholder location="xxx.properties" ignore-unresolvable="true"/>

    (2) 但是Spring 2.5中,没有ignore-unresolvable属性,所以就不能使用上面的那种方法去配置,

    可以改如下的格式:

    <bean id="propertyConfigurer"

    class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">

    <property name="locations">

    <list>

    <value>classpath:/jdbc.properties</value>

    </list>

    </property>

    </bean>

  • 相关阅读:
    window XP下 php5.5+mysql+apache2+phpmyadmin安装
    poj2478Farey Sequence
    poj2723Get Luffy Out
    niop2015day2
    P2473 [SCOI2008]奖励关
    P4284 [SHOI2014]概率充电器
    P2486 [SDOI2011]染色
    noip2015day1
    hdu 2795 Billboard
    exgcd
  • 原文地址:https://www.cnblogs.com/sharpest/p/7476673.html
Copyright © 2011-2022 走看看