---
title: "杂项 "
author: "zaife"
date: "2007-11-07T17:40:52Z"
tags: ["Bean", "Spring", "Web", "XML", "iBATIS"]
slug: "untitled"
draft: false
lastmod: "2007-11-07T17:40:52Z"
id: 138832
url: "https://zaife.iteye.com/blog/138832"
---

spring数据源配置

1. &lt;bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean"  singleton="true"&gt;
2. &lt;property name="jndiName"&gt;
3. &lt;value&gt;tempDS&lt;/value&gt;
4. &lt;/property&gt;
5. &lt;/bean&gt;

 

spring 整合 iBatis

1. &lt;bean id="sqlMapClient"
2. class="org.springframework.orm.ibatis.SqlMapClientFactoryBean"&gt;
3. &lt;property name="configLocation"&gt;
4. &lt;value&gt;/WEB-INF/sql-map-config.xml&lt;/value&gt;
5. &lt;/property&gt;
6. &lt;property name="dataSource" ref="dataSource" /&gt;
7. &lt;/bean&gt;

 

web.xml   中 spring (一种方式)

01. &lt;context-param&gt;
02. &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
03. &lt;param-value&gt;
04. /WEB-INF/spring-config-global.xml
05. &lt;/param-value&gt;
06. &lt;/context-param&gt;
07. &lt;listener&gt;
08. &lt;listener-class&gt;
09. org.springframework.web.context.ContextLoaderListener
10. &lt;/listener-class&gt;
11. &lt;/listener&gt;