springmvc事务注解 All calls method via a proxy will be routed directly

J2EE 码拜 9年前 (2015-04-09) 1939次浏览 0个评论

springmvc 事务注解。

[WARN] [2014-10-11 22:20:45]  [ Class = org.springframework.aop.framework.CglibAopProxy | Method = doValidateClass | Line = 262 ] | Unable to proxy method [public final void org.springframework.dao.support.DaoSupport.afterPropertiesSet() throws java.lang.IllegalArgumentException,org.springframework.beans.factory.BeanInitializationException] because it is final: All calls to this method via a proxy will be routed directly to the proxy. |

现在 服务器报了 这样的警告,,

网上 有这样的解决办法

log4j.logger.org.springframework.aop.framework.CglibAopProxy = ERROR
但这算是屏蔽吗?

下面这个人 说的好恐怖,。。。
http://langgufu.iteye.com/blog/1561745

有没有专业的大神可以解释、、、、和解决办法

springmvc事务注解 All calls  method via a proxy will be routed directly
40分
其实异常提示的很清楚了,你发的这个帖子也讲的比较明白!你的CommonDao继承了HibernateDAOSupport,而父类含有final的方法无法被AAOP代理,解决方式可以把HibernateDAOSupport在context里面用Bean配置好,然后作为CommonDao的属性采用@Autowire来试试.
springmvc事务注解 All calls  method via a proxy will be routed directly
引用 1 楼 littlebrain4solving 的回复:

其实异常提示的很清楚了,你发的这个帖子也讲的比较明白!你的CommonDao继承了HibernateDAOSupport,而父类含有final的方法无法被AAOP代理,解决方式可以把HibernateDAOSupport在context里面用Bean配置好,然后作为CommonDao的属性采用@Autowire来试试.

确实好了,,,我没有再让  CommonDao 继承 SqlSessionDaoSupport,从而获取,SqlSession,

	<!-- SqlSessionTemplate -->
	<bean id="sqlSession" class="org.mybatis.spring.SqlSessionTemplate" scope="prototype"> 
	              <constructor-arg index="0" ref="sqlSessionFactory" />  
	                <constructor-arg index="1" value="BATCH" />	 <!--  如果想要进行批量操作可加入这个属性 -->
	</bean>

要配置 scope=”prototype”  不然 会抛警告,

 <WARN> [org.springframework.beans.factory.support.DisposableBeanAdapter (line-337)] – Invocation of destroy method “”close”” failed on bean with name “”sqlSession””: java.lang.UnsupportedOperationException: Manual close is not allowed over a Spring managed SqlSession

(scope=”prototype”  是保证他线程安全吗?)

CommonDao 注入了一个 sqlSession,

public class CommonDao {

       @Resource
	private SqlSession session; // 注入一个session

	public void setSession(SqlSession session) {
		this.session = session;
	}

	public SqlSession getDAO()
	{
		return this.session;
	}

}

错误确实没了,,,万分感谢。。。

引用

springmvc事务注解 All calls  method via a proxy will be routed directly


CodeBye 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明springmvc事务注解 All calls method via a proxy will be routed directly
喜欢 (0)
[1034331897@qq.com]
分享 (0)

文章评论已关闭!