zoukankan      html  css  js  c++  java
  • spring mvc注入配置文件里的属性

    	<bean
    		class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
    		<property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE" />
    		<property name="ignoreResourceNotFound" value="true" />
    		<property name="locations">
    			<list>
    				<value>classpath:config.properties</value>
    				<value>classpath:db.properties</value>
    			</list>
    		</property>
    	</bean>

    spring的主配置文件中,可是程序里面还是读去不到,读取到的只是$("属性名")这样的字符串,并没有解析这个表达式,后来想了下,我项目是用spring mvc的,主要是controller需要读取这些配置信息,而spring mvc的配置文件和spring的配置文件非同一个,把上面的配置文件放到spring mvc的配置文件中就解决了这个问题,记录一下以防遗忘。



    可以配置多个配置文件 比如数据库的配置 自定义的配置

  • 相关阅读:
    IfcFeatureElementAddition
    IfcOpeningElement
    IfcRelNests
    IfcElementAssemblyType
    IfcProjectionElement
    IfcFeatureElement
    IfcRelDefines
    Win10 Anaconda配置tensorflow
    Anaconda升级
    Anaconda 台式机环境
  • 原文地址:https://www.cnblogs.com/zhousiwei/p/10625936.html
Copyright © 2011-2022 走看看