zoukankan      html  css  js  c++  java
  • 解决关于配置文件的占位符无法读取问题

    前提是:

      其他的配置文件中已经配置了<context:property-placeholder location="classpath:jdbc.properties"/>

    主要原因是:

      Spring容器采用反射扫描的发现机制,在探测到Spring容器中有一个org.springframework.beans.factory.config.PropertyPlaceholderConfigurer的Bean就会停止对剩余PropertyPlaceholderConfigurer的扫描(Spring 3.1已经使用PropertySourcesPlaceholderConfigurer替代PropertyPlaceholderConfigurer了)。而<context:property-placeholder/>这个基于命名空间的配置,其实内部就是创建一个PropertyPlaceholderConfigurer Bean而已。换句话说,即Spring容器仅允许最多定义一个PropertyPlaceholderConfigurer(或<context:property-placeholder/>),其余的会被Spring忽略掉。

    解决方法是:
      改成<context:property-placeholder location="classpath:redis.properties" ignore-unresolvable="true"/>
     
    如果上述问题仍没有解决在一个配置文件中直接使用<context:property-placeholder location="classpath:*.properties"/>
  • 相关阅读:
    时间选择框(可用于Form)
    点击复制指定内容
    ajax中多个模板之间套用ajax
    Java学习路径
    Windows平台安装Python
    Python语法-第2关
    Python语法-第1关
    Python语法-第0关
    图像识别
    wx:for用法
  • 原文地址:https://www.cnblogs.com/BINGJJFLY/p/7560222.html
Copyright © 2011-2022 走看看