今天做一个S2SH项目的练习,配置SpringContext.xml,当进行关于事务的配置时,遇到标题所示错误;
解决方法记录如下:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<span style="color:#FF0000;"> xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"</span>
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
<span style="color:#FF0000;"> http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-2.0.xsd"></span>
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="configLocation" value="WEB-INF/conf/hibernate.cfg.xml">
</property>
</bean>
<bean id="txManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<tx:advice id="tx" transaction-manager="txManager">
<tx:attributes>
<tx:method name="add*" propagation="REQUIRED" rollback-for="Exception" />
<tx:method name="save*" propagation="REQUIRED"
rollback-for="Exception" />
<tx:method name="remove*" propagation="REQUIRED"
rollback-for="Exception" />
<tx:method name="delete*" propagation="REQUIRED"
rollback-for="Exception" />
<tx:method name="update*" propagation="REQUIRED"
rollback-for="Exception" />
<tx:method name="register*" propagation="REQUIRED"
rollback-for="Exception" />
<tx:method name="*" read-only="true" />
</tx:attributes>
</tx:advice>
<aop:config>
<aop:pointcut id="trAllMethod"
<span style="color:#009900;">expression="execution(* com.hsExt.service.*.*(..))" /></span>
<aop:advisor advice-ref="tx" pointcut-ref="trAllMethod" />
</aop:config>
</beans>
问题原因:Myeclipse不能识别<tx:advice/>标签,在定义申请AOP的时候,不能加载schema,在<beans >里加入如上述代码所示的代码片段,Myeclipse就能够识别<tx:advice/>,<aop:config/>;
代码片段中,几个通配符的含义:
第一个 * —— 通配任意返回值类型
第二个 * —— 通配com.hsExt.service包下的任意class
第三个 * —— 通配com.hsExt.service包下的任意class的任意方法
第四个 .. —— 通配方法可以有0个或多个参数
所以(* com.hsExt.service.*.*(..))匹配:包com.hsExt.service下的任意class的具有任意返回值类型、任意数目参数和任意名称的方法。
分享到:
相关推荐
Name salesDataSource is not bound in this Context,连接池的问题
配置tomcat7sqlserver数据连接池java 利用数据源对象建立数据库连接时的错误: Name jdbc is not bound in this Context 解决方案
No Hibernate Session bound to thread,没有绑定线程解决办法,找了好久才找到的
UIUC Math 482: Linear Programming. Lecture 33: The Branch-and-Bound Method(课程讲义)
今天在处理bug的时候发现某一个很奇怪的问题,在执行某类操作的时候会报:Invalid parameter number: no parameters were bound,但是该问题在本地或是测试机上测试都没有重现,猜想是否和版本有关,于是就google了...
搭建项目时使用了mybatisplus,项目能够正常启动,但在调用mapper方法查询数据库时报Invalid bound statement (not found)错误。本文给大家分享解决方案,感兴趣的朋友跟随小编一起看看吧
这是每一个有竞争力的程序员都必须阅读和掌握的书,至少在他们编程生涯的中期。
本案例主要是分别实现Spring与jdbc和hibernate结合的事务控制,如果该案例有出入的地方,请给我留言,我们一起交流
Competitive Programming 3 The New Lower Bound of Programming Contests
主要介绍了MyBatis绑定错误提示BindingException:Invalid bound statement (not found)的解决办法,非常不错,具有参考借鉴价值,需要的的朋友参考下吧
Spring JavaMailSenderImpl does not show proper message when recipient list is empty [SPR-17540] #22072 'default-lazy-init' attribute is not processed when XSD validation is disabled [SPR-8335] #12983
lower_bound函数lower_bound函数用法及应用领域和案例分享lower_bound函数用法及应用领域和案例分享lower_bound函数用法及应用领域和案例分享lower_bound函数用法及应用领域和案例分享lower_bound函数用法及应用领域...
没有目标目录时,相当于完全复制源目录,只是文件名不同。 cp beans apple dir2 把beans、apple文件复制到dir2目录下 cp -i beans apple 增加是否覆盖的提示 mv 移动或重命名文件/目录 用法 mv [-f] [-i] f1 f2...
主要介绍了使用mybatis-plus报错Invalid bound statement (not found)错误,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧
jmxutils.zip,导出jmx mbean使导出jmx mbean变得容易
not bound,jboss不能热部署jar文件,jboss不能生成对应的jndi,jar部署到deploy下没有部署信息反馈,jboss端口更改, jboss常见问题处理,
主要介绍了引入mybatis-plus报 Invalid bound statement错误问题的解决方法,需要的朋友可以参考下
lower_bound函数
错误信息: XXXX client has already been bound to another coroutine使用协程客户端时出现以下错误信息:re