zoukankan      html  css  js  c++  java
  • Spring 配置中的 ${}

    Spring 配置中的 ${}

        <!-- ============ GENERAL DEFINITIONS========== -->

    <!-- Configurer that replaces ${...} placeholders with values from a properties file -->

    <!-- (in this case, JDBC-related settings for the dataSource definition below) -->

    <bean id="propertyConfigurer"

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

    <property name="location">

    <value>classpath:spring/jdbc-oracle.properties</value>

    </property>

    </bean>

    <!-- =========== RESOURCE DEFINITIONS ============ -->

    <!-- Local DataSource that works in any environment -->

    <bean id="dataSource"

    class="org.springframework.jdbc.datasource.DriverManagerDataSource">

    <property name="driverClassName">

    <value>${jdbc.driverClassName}</value>

    </property>

    <property name="url">

    <value>${jdbc.url}</value>

    </property>

    <property name="username">

    <value>${jdbc.username}</value>

    </property>

    <property name="password">

    <value>${jdbc.password}</value>

    </property>

    </bean>

    当jdbc-oracle.properties文件加载下后,${}即可取出其中的内容

  • 相关阅读:
    我对管理信息系统定位的理解
    正斜杠和反斜杠-windows、web、c语言大讨论
    java异常处理的两种方法
    使用throws抛出异常
    课后作业
    每日自学
    《梦断代码》读后感
    每日自学
    每日自学
    每日自学
  • 原文地址:https://www.cnblogs.com/flying607/p/3486918.html
Copyright © 2011-2022 走看看