Spring分配置文件开发

本文介绍了如何在Spring项目中管理多个配置文件,通过两种模式实现配置文件的整合:模式1是构造时传入每个配置文件,如demo.xml和demo1.xml;模式2是在主配置文件app.xml中引入分配置文件,以此简化项目中的配置管理。
摘要由CSDN通过智能技术生成

Spring分配置文件开发

在一个项目中如果有太多的Spring xml文件,我们可以进行整合管理

模式1:

构造时传入每个配置文件
Spring 配置文件
demo.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
    <bean name="bean2" class="com.example.Bean2"></bean>
    <bean name="bean1" class="com.example.Bean1">
        <property name="num" value="#{T(java.lang.Math).random()}"></property>
        <property name="map" value="#{ {'dsd':'gsdf'}}"></property>
        <property name=
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值