随笔分类 - Spring
摘要:1、构造方法注入 类中提供构造方法 bean.xml中通过constructor-arg为构造方法的参数赋值 2、setter方法注入 类中提供setter方法 bean.xml中通过property标签配置注入 3、集合的注入方式 类中提供setter方法 package com.alphajun
阅读全文
摘要:1、空参构造方法 2、静态工厂方法 3、实例工厂 bean.xml <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://
阅读全文
摘要:需要在spring配置文件中配置springContextUtil的bean <bean id="SpringContextUtil" lazy-init="false" class="com.alphajuns.ssm.util.SpringContextUtil" /> SpringContex
阅读全文
摘要:以简单的转账案例演示 配置基于xml的声明式事务 在事务中调用非事务形式的方法插入数据到数据库,当前事务被挂起,数据被立即插入到数据库 debug过程
阅读全文
摘要:<!-- 配置Spring的声明式事务管理 --> <!-- 配置事务管理器 --> <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> <pr
阅读全文