struts2 + spring 整合的问题
来源:互联网 发布:企业网站域名申请流程 编辑:程序博客网 时间:2024/05/18 01:23
最近我们开的项目使用struts2+spring的时候,在遇到提交页面的遇到dao为空(已经在spring里注入),
大概异常见下:
java.lang.NullPointerException
com.richser.web.action.ServiceAction.save(ServiceAction.java:55)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
java.lang.reflect.Method.invoke(Unknown Source)
也就是说:dao没有实例化了
解决办法:
配置spring的事务
<!-- 以AspectJ方式定义 AOP -->
<aop:config proxy-target-class="true">
<aop:pointcut id="contractService"
expression="execution(* com.richserc.contract.service..*ContractTypeService.*(..))"/>
<aop:pointcut id="contractWebService"
expression="execution(* com.richserc.contract.web..*ContractTypeAction.*(..))"/>
<aop:advisor advice-ref="txAdvice" pointcut-ref="contractService" />
<aop:advisor advice-ref="txAdvice" pointcut-ref="contractWebService" />
</aop:config>
<!-- 基本事务定义,使用transactionManager作事务管理
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="save*"/>
<tx:method name="update*"/>
<tx:method name="remove*"/>
<tx:method name="*" read-only="true"/>
</tx:attributes>
</tx:advice>
建议和http://blog.csdn.net/xray_gu/archive/2007/06/18/1656062.aspx一并参考
- struts2 + spring 整合的问题
- struts2 spring hibernate整合的问题
- 关于struts2与spring的整合问题
- 关于struts2-spring整合的问题
- struts2和spring整合问题
- Struts2整合Spring有关问题
- Struts2+Spring +ibatis 整合问题
- struts2单例多例问题以及spring整合的问题
- struts2+Spring 整合注意会出现的问题
- Spring + Mybatis + Struts2 整合时出现的问题
- Struts2与Spring整合时Action的创建问题
- spring整合struts2遇到的问题一:scope设置
- Struts2+Spring+Hibernate整合的一个小问题
- spring 整合struts2 使用 aop 碰到的问题
- Struts2整合Spring创建的Action同步问题
- Struts2 和spring整合的 Action层托管问题
- struts2与spring整合时的单例问题
- Spring 与Struts2整合遇到的问题以及解决方案
- 文件名progra~1的由来
- 【低调朋友和我聊架构师】中国架构师,名符其实有多少?
- VB的键码常数,A 键到 Z 键与其 ASCII 码的相应值,数字小键盘上的键,功能键
- 用OpenCV库函数捕捉图像上传FTP服务器
- C++线程同步技术剖析
- struts2 + spring 整合的问题
- Photoviewer缺失資源包的運行錯誤
- editplus删除空行
- Mysql5.0.18安装
- VB:常用内部函数大全,你会了几个呢?
- VC++6.0中内存泄漏检测
- 阻塞一一般处理/解决方法是
- 优赞技术盛宴,荷兰工程师教你吃烤鸭
- JNI示例