zoukankan      html  css  js  c++  java
  • 【Spring】spring配置文件中配置外部配置文件(jdbcConfig.properties等)

    问题

    如何在Spring的配置文件中配置外部的配置文件,比如jdbcConfig.properties等?

    解决

    1 <!--读取配置文件-->
    2     <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
    3         <property name="locations">
    4             <list>
    5                 <value>classpath:jdbcConfig.properties</value>
    6                 <!--要是有多个配置文件,只需在这里继续添加即可 -->
    7             </list>
    8         </property>
    9     </bean>

    注意:jdbcConfig.properties放在resources中

    使用的话,${}就可以。

  • 相关阅读:
    Redis基础
    MySQL基础
    MySQL基础
    MySQL基础
    MySQL基础
    Hello 博客园
    Linux | 常用命令
    JVM | 性能调优
    JVM | 垃圾回收
    学习笔记 | 分布式技术
  • 原文地址:https://www.cnblogs.com/AirCL/p/14187329.html
Copyright © 2011-2022 走看看