Unable to proxy method HibernateDaoSupport.setHibernateTemplate because it is final
2014-05-14 23:24
731 查看
最近整合struts 1 + spring 2.5 + hibernate 3.2,demo调通后分析日志,发现控制台输出一系列警告:
警告: Unable to proxy method [public final org.springframework.orm.hibernate3.HibernateTemplate org.springframework.orm.hibernate3.support.HibernateDaoSupport.getHibernateTemplate()] because it is final:
All calls to this method via a proxy will be routed directly to the proxy.
2014-5-14 22:47:52 org.springframework.aop.framework.Cglib2AopProxy doValidateClass
解决方案:修改applicationContext.xml中spring事务控制机制,换一种实现方案。
报警告信息的配置:
复制去Google翻译翻译结果
警告: Unable to proxy method [public final org.springframework.orm.hibernate3.HibernateTemplate org.springframework.orm.hibernate3.support.HibernateDaoSupport.getHibernateTemplate()] because it is final:
All calls to this method via a proxy will be routed directly to the proxy.
2014-5-14 22:47:52 org.springframework.aop.framework.Cglib2AopProxy doValidateClass
解决方案:修改applicationContext.xml中spring事务控制机制,换一种实现方案。
报警告信息的配置:
<!-- 指定事务管理器类,将sessionFactory注入,让该事务管理器具有打开和关闭事务的能力 --> <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"> <property name="sessionFactory" ref="sessionFactory"></property> </bean> <!-- 为事务管理器类指定匹配器,通过用name指定的匹配字符串进行对对应的方法进行打开和关闭事务 --> <tx:advice id="txAdvice" transaction-manager="transactionManager"> <tx:attributes> <tx:method name="save*" propagation="REQUIRED" /> <tx:method name="delete*" propagation="REQUIRED" /> <tx:method name="modify*" propagation="REQUIRED" /> <tx:method name="deploy*" propagation="REQUIRED" /> <tx:method name="*" read-only="true" /> </tx:attributes> </tx:advice> <!-- 为事务管理器类指定进行匹配的范围,到指定的地方通过匹配器字符串进行筛选,对应上后为该方法打开和关闭事务 --> <aop:config proxy-target-class="true"> <aop:pointcut id="managerOperation" expression="execution(* com.xy6.dao.*.*(..))" /> <aop:advisor advice-ref="txAdvice" pointcut-ref="managerOperation" /> </aop:config>修改后的配置:
<bean id="myTransactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"> <property name="sessionFactory" ref="sessionFactory" /> </bean> <bean id="myBaseTransactionProxy" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean" abstract="true"> <property name="transactionManager" ref="myTransactionManager" /> <property name="transactionAttributes"> <props> <prop key="*">PROPAGATION_REQUIRED</prop> <!-- <prop key="insert*">PROPAGATION_REQUIRED</prop> <prop key="save">PROPAGATION_REQUIRED</prop> <prop key="update*">PROPAGATION_REQUIRED</prop> <prop key="edit*">PROPAGATION_REQUIRED</prop> <prop key="del*">PROPAGATION_REQUIRED</prop> <prop key="get*">PROPAGATION_REQUIRED,readOnly</prop> <prop key="query*">PROPAGATION_REQUIRED,readOnly</prop> <prop key="disPlay*">PROPAGATION_REQUIRES_NEW</prop> --> </props> </property> </bean>警告产生原因:org.springframework.orm.hibernate3.support.HibernateDaoSupport类中getHibernateTemplate等方法为final类型。
复制去Google翻译翻译结果
相关文章推荐
- Bug on Build Solution: "Unable to copy file... because it is being used by another process.."
- We are unable to upload this Certificate file because it is invalid.
- The service cannot be activated because it does not support ASP.NET compatibility. ASP.NET compatibility is enabled for this application. Turn off ASP.NET compatibility mode in the web.config or add the AspNetCompatibilityRequirements attribute to the ser
- Spring结合Hibernate出现的异常The type org.springframework...DaoSupport cannot be resolved. It is indirectly...(
- Invocation of init method failed; nested exception is org.hibernate.HibernateException: Unable to instantiate default tuplizer [
- 解决编译报错:Unable to copy file, because it is being used by another process.
- Cannot convert anonymous method to type 'System.Delegate' because it is not a delegate type
- Cannot override the final method from HibernateDaoSupport
- 更新EntityFramework数据,提示:Unable to update the Entityset'User' because it has a DefiningQuery
- DataBoundControl support Template 【it is similar with Repeater control】
- Unable to find required classes (javax.activation.DataHandler and javax.mail.internet.MimeMultipart). Attachment support is disa
- Oracle Bug: WARNING:Could not lower the asynch I/O limit to 224 for SQL direct I/O. It is set to -1
- Support - Unable to register keys or sign a file while behind a proxy server
- Response.Redirect出现Unable to evaluate expression because the code is optimized or a native frame……异常解决方法
- 【随】Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack 问题解决。
- 错误解决:Unable to add module to the current project as it is not of packagi
- How to get a type in C++ when its template argument is the argument
- E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?
- Is it possible to set font for entire Application?
- Unable to start debugging on the web server. Debugging failed because integrated windows authentication is not enabled.