第一步:在外部创建properties的文件
    image.png
    第二步:在xml中添加context链接

    1. <beans
    2. xmlns:context="http://www.springframework.org/schema/context"
    3. xsi:schemaLocation="
    4. http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
    5. </beans>

    第三步:创建可访问文件标签权限

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

    第四步:通过${properties文件所设置的名称}

    1. <bean id="druid" class="com.alibaba.druid.pool.DruidDataSource">
    2. <property name="driverClassName" value="${prop.driverClass}"/>
    3. <property name="url" value="${prop.url}"/>
    4. <property name="username" value="${prop.userName}"/>
    5. <property name="password" value="${prop.password}"/>
    6. </bean>