在网上看到一篇关于struts2+spring+hibernate的文章,其中spring的配置文件分为三个:
applicationContext-actions.xml
applicationContext-beans.xml
applicationContext-common.xml
其中applicationContext-common.xml文件内容如下:
[code="xml"]
<?xml version="1.0" encoding="UTF-8"?>
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd">
<!-- 配置sessionFactory -->
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="configLocation">
<value>classpath:hibernate.cfg.xml</value>
</property>
</bean>
<!-- 配置事务管理器 -->
<bean id="transactionManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory">
<ref bean="sessionFactory" />
</property>
</bean>
<!-- 配置事务的传播特性 -->
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="add*" propagation="REQUIRED" />
<tx:method name="delete*" propagation="REQUIRED" />
<tx:method name="modify*" propagation="REQUIRED" />
<tx:method name="*" read-only="true" />
</tx:attributes>
</tx:advice>
<!-- 那些类的哪些方法参与事务 -->
<aop:config>
<aop:advisor pointcut="execution(* com.test.manager.*.*(..))"
advice-ref="txAdvice" />
</aop:config>
[/code]
使用的MyEclipse5.5,配置文件的最后:aop:config报错,错误信息如下:
[img]/upload/attachment/127825/40d86512-8810-3ace-8d4a-b3f905d7bd01.jpg[/img]
请问可能的错误原因是什么?
[b]问题补充:[/b]
wcp_010 (初级程序员) :没有看出哪里错了。
pan_java (中级程序员):你的方法试了,还是不行,报错。
[b]问题补充:[/b]
jansel (初级程序员) ,你的回答帮我解决了问题。
就是因为MyEclipse中的XML Catalog 里面有没有配置Spring aop。
同时,通过"MyEclipse中的XML Catalog"这个关键词,还找到了解决MyEclipse的xml验证速度过慢的解决办法。
在此,表示感谢!(这个问题已经折腾我2天了)