ssh,ssi配置文件

<!-- log4jdbc可以将数据源执行的sql将占位符?替换成字符,并以日志打印出来. log4j配置: log4j.logger.jdbc.sqltiming=INFO    详情请看: http://code.google.com/p/rapid-framework/wiki/log4jdbc
	如oracle示例: 
		原来的sql: select * from user where birth_date = ? and username = ? and age > ?
		转换后sql: select * from user where birth_date = to_date('2010-08-13','yyyy-mm-dd') and username = 'badqiu' and age > 20
	 -->
	<bean id="log4jdbcInterceptor" class="net.sf.log4jdbc.DataSourceSpyInterceptor" />
    <bean id="dataSourceLog4jdbcAutoProxyCreator" class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator">
       <property name="interceptorNames">
           <list>
              <value>log4jdbcInterceptor</value>        
           </list>
       </property>
       <property name="beanNames">
           <list>
              <value>dataSource</value>
           </list>
       </property>
    </bean>

 

    通过属性文件加载数据源:

   

<!-- 加载数据库连接properties文件 -->
	<bean id="propertyConfigurer"
		class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
		<property name="location">
			<!-- 测试环境 -->
			<value>classpath:jdbc.properties</value>
			<!-- 生产环境
			<value>classpath:realjdbc.properties</value> -->
		</property>
	</bean>

 

    

<bean id="dataSource"
		class="org.springframework.jdbc.datasource.DriverManagerDataSource">
		<property name="driverClassName">
			<value>${database.driver}</value>
		</property>
		<property name="url">
			<value>${database.url}</value>
		</property>
		<property name="username">
			<value>${database.username}</value>
		</property>
		<property name="password">
			<value>${database.password}</value>
		</property>
	</bean>

 

你可能感兴趣的:(配置文件)