准备为下一个项目搭一个swing+spring2.5+ibatis2的框架,这三个都没有用过,spring现在公司用的还是1.2的,orm用的是hibernate。真的做起来,问题是层出不穷啊。
1.spring2.5配置文件报 the attribute "xmlns" must be in the beans错误。
解决方法:google到说要用新的spring-beans-2.0.xsd,该了没有成功。直接删掉beans上的DOCTYPE声明,问题解决。
2.ibatis报找不到statement id。
查看配置pojo的ibatis配置文件,如果带有namespace,在sql-map-config.xml中加入<settings useStatementNamespaces="true" />,然后用namespace值加statmentid做为参数,问题解决。
3.利用2.5自带的testframework进行单元测试,提示找不到bean。
在class上添加注解
@ContextConfiguration(locations={"yourspringconfig.xml"})
@TransactionConfiguration(transactionManager="txManager", defaultRollback=false)
4.test中被注入的接口的setter方法添加注解@Autowired
5.事务配置中expression="execution(* com..*.*(..))",包含所有com包及其子包下的所有类和方法,如果是expression="execution(* com.*.*(..))",则只对com包下的类进行事务管理。
1.spring2.5配置文件报 the attribute "xmlns" must be in the beans错误。
解决方法:google到说要用新的spring-beans-2.0.xsd,该了没有成功。直接删掉beans上的DOCTYPE声明,问题解决。
2.ibatis报找不到statement id。
查看配置pojo的ibatis配置文件,如果带有namespace,在sql-map-config.xml中加入<settings useStatementNamespaces="true" />,然后用namespace值加statmentid做为参数,问题解决。
3.利用2.5自带的testframework进行单元测试,提示找不到bean。
在class上添加注解
@ContextConfiguration(locations={"yourspringconfig.xml"})
@TransactionConfiguration(transactionManager="txManager", defaultRollback=false)
4.test中被注入的接口的setter方法添加注解@Autowired
5.事务配置中expression="execution(* com..*.*(..))",包含所有com包及其子包下的所有类和方法,如果是expression="execution(* com.*.*(..))",则只对com包下的类进行事务管理。