1. Spring 的PropertyPlaceholderConfigurer
PropertyPlaceholderConfigurer是Spring的bean工厂购置处理器,可将配置文件的属性值放在一个单独配置文件(properties)中,在xml文件处理时用$(key)的方式指代配置文件中的值。这样只需对properties文件进行修改而不必改xml文件。
用法示例:
<bean id="propertyConfigurer"class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location"><!-- 指定配置文件 -->
<value>conf/sqlmap/jdbc.properties</value>
</property>
<property name="fileEncoding"><!-- 指定编码-->
<value>UTF-8</value>
</property>
</bean>
2.Spring 事务声明
Spring 支持编程式事务管理和声明式事务管理
1.编程式事务管理使用TransactionTemplate或者直接使用底层的PlatformTransactionManager。对于编程式事务管理,spring推荐使用TransactionTemplate。