Spring配置文件的拆分
2013-11-12 13:12
274 查看
有两种拆分方式,也就路径不同而已。
1.其中spring配置文件在src目录下,spring是个包
在web.xml文件中
2.其中Spring的配置文件在WebRoot中的WEB-INF中,springConfig是个文件夹。
在web.xml文件中
每个Spring的配置文件中都可以包含类似的代码。
1.其中spring配置文件在src目录下,spring是个包
在web.xml文件中
<!-- 配置spring --><context-param><param-name>contextConfigLocation</param-name><param-value>classpath:spring/applicationContext.xml</param-value></context-param><listener><listener-class>org.springframework.web.context.ContextLoaderListener</listener-class></listener>
2.其中Spring的配置文件在WebRoot中的WEB-INF中,springConfig是个文件夹。
在web.xml文件中
<!-- 配置spring监听器 --><context-param><param-name>contextConfigLocation</param-name><param-value>classpath:spring/applicationContext.xml</param-value></context-param><listener><listener-class>org.springframework.web.context.ContextLoaderListener</listener-class></listener>
每个Spring的配置文件中都可以包含类似的代码。
<?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:p="http://www.springframework.org/schema/p"xmlns:tx="http://www.springframework.org/schema/tx" xmlns:aop="http://www.springframework.org/schema/aop"xsi:schemaLocation="http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans-2.5.xsdhttp://www.springframework.org/schema/txhttp://www.springframework.org/schema/tx/spring-tx-2.5.xsdhttp://www.springframework.org/schema/aophttp://www.springframework.org/schema/aop/spring-aop-2.5.xsd"></beans>
相关文章推荐
- 拆分Spring配置文件
- Spring的数据源引用问题,拆分配置文件
- Spring配置文件applicationContext.xml的两种拆分方式
- Spring配置文件拆分
- Spring配置文件applicationContext.xml的两种拆分方式
- Spring web flow 配置文件
- 借助BeanFactoryPostProcessor修改spring配置文件
- 获取Spring配置文件属性
- spring 配置文件
- Spring下用Acegi的配置文件实例
- Spring配置文件报错问题
- Spring实现热加载MyBatis 的XML配置文件
- spring05 spring配置文件
- 读取Spring配置文件
- Spring配置文件总结(转)
- Spring Boot 01 加载配置文件和获取key/value值
- 使用spring配置文件实现AOP
- Spring配置文件中属性值不能提示的解决办法(eclipse添加xsd文件)
- spring配置文件注解方式引入的两种方式
- spring配置文件的整合