加载properties文件

1.开启context命名空间:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:context="http://www.springframework.org/schema/context"
       xsi:schemaLocation="
       http://www.springframework.org/schema/beans
       http://www.springframework.org/schema/beans/spring-beans.xsd
       http://www.springframework.org/schema/context
       http://www.springframework.org/schema/context/spring-context.xsd">

2.使用context空间加载properties文件

<context:property-placeholder location="jdbc.properties"/>

3.使用${ }占位符获取properties中的数据

posted @ 2023-02-17 18:04  会秃头的小白  阅读(18)  评论(0编辑  收藏  举报