spring开启事务时启动报错SAXParseException

在启动项目时报解析xml文件异常:

org.xml.sax.SAXParseException: cvc-complex-type.2.4.c ‘aop:config‘......

由报错提示可知,是aop产生的问题,打开配置文件,经过查看后才知道是没有加aop声明:

<!--开启基于注解的事务,使用xml配置形式的事务(必要主要的都是使用配置式) -->

<aop:config>

<!-- 切入点表达式 -->

<aop:pointcut expression="execution(* com.dxt.bx.reader.api.service..*(..))" id="txPoint"/>

<!-- 配置事务增强 -->

<aop:advisor advice-ref="txAdvice" pointcut-ref="txPoint"/>

</aop:config>

<!--配置事务增强,事务如何切入 -->

<tx:advice id="txAdvice" transaction-manager="transactionManager">

<tx:attributes>

<!-- 所有方法都是事务方法 -->

<tx:method name="*"/>

<!--以xxx开始的所有方法的传播行为 -->

<tx:method name="get*" read-only="true"/>

<tx:method name="save*" propagation="REQUIRED"/>

<tx:method name="insert*" propagation="REQUIRED"/>

<tx:method name="add*" propagation="REQUIRED"/>

<tx:method name="create*" propagation="REQUIRED"/>

<tx:method name="delete*" propagation="REQUIRED"/>

<tx:method name="update*" propagation="REQUIRED"/>

<tx:method name="find*" propagation="SUPPORTS" read-only="true"/>

<tx:method name="select*" propagation="SUPPORTS" read-only="true"/>

<tx:method name="get*" propagation="SUPPORTS" read-only="true"/>

</tx:attributes>

</tx:advice>

在xml开头加上声明:

xmlns:aop="http://www.springframework.org/schema/aop"

xsi:schemaLocation=“http://www.springframework.org/schema/aop

http://www.springframework.org/schema/aop/spring-aop-4.0.xsd

加上后就正常了。

原文地址:https://www.cnblogs.com/dingxu/p/8999452.html

时间: 2024-10-27 13:30:22

spring开启事务时启动报错SAXParseException的相关文章

【spring boot】mybatis启动报错:Consider defining a bean of type &#39;com.newhope.interview.dao.UserMapper&#39; in your configuration.

启动报错: 2018-02-24 22:41:00.442 WARN 2952 --- [ main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error c

spring cloud gateway网关启动报错:No qualifying bean of type &#39;org.springframework.web.reactive.DispatcherHandler&#39;

网关配置好后启动报错如下: org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is java.lang.RuntimeException: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'servletEndpoint

maven创建spring项目之后,启动报错java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener

出错情景:maven中已经加载了spring的核心包,但是项目启动时,报错: org.apache.catalina.core.StandardContext listenerStart严重: Error configuring application listener of class org.springframework.web.context.ContextLoaderListenerjava.lang.ClassNotFoundException: org.springframewor

【spring data jpa】启动报错:nested exception is java.util.NoSuchElementException

spring boot项目中 使用spring data jpa 启动报错: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'dealerTransferServiceImpl': Unsatisfied dependency expressed through field 'dealerTransferDao'; nested exception i

Spring Boot整合Elasticsearch启动报错

如果你遇见下面的错误,很可能是你的springboot和es版本关系不对应 ERROR 14600 --- [ main] .d.e.r.s.AbstractElasticsearchRepository : failed to load elasticsearch nodes : org.elasticsearch.client.transport.NoNodeAvailableException: None of the configured nodes are available: [{#

IDEA下spring boot+fremarker启动报错would dispatch back to the current handler URL [/hello] again. Check your ViewResolver setup!

详细报错代码(ps:标题中写不下报错主要代码) javax.servlet.ServletException: Circular view path [hello]: would dispatch back to the current handler URL [/hello] again. Check your ViewResolver setup! (Hint: This may be the result of an unspecified view, due to default vie

spring boot + jersey工程由jar包转为war包在tomcat中启动报错问题

第一步: 在maven下,将Spring Boot工程由jar转换为war包启动,很简单,将pom.xml文件中的packaging改为war <packaging>war</packaging> 如果你使用Gradle,你需要修改build.gradle来将war插件应用到项目上: apply plugin: 'war'第二步: 产生一个可部署war包的第一步是提供一个SpringBootServletInitializer子类,并覆盖它的configure方法.这充分利用了Sp

struts2启动报错com/opensymphony/xwork2/spring/SpringObjectFactory.java:220:-1

好久没有搞struts2,今天配置strut2.2.1,启动时遇到个小问题.记录下. tomcat启动报错: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 Class: com.opensymphony.xwork2.spring.SpringObjectFactory File: SpringObjectFactory.java Method: getClassInstance Line: 220

ios替换app启动图片时系统报错的解决办法

ios替换app启动图片时系统报错的解决办法:我个人建议是在开发时候经常行的保存项目,并且在修改项目图标图片.app启动图片前,一定要先备份一份没有添加这两项图片的项目. 如果您的项目已经开发完成了,进入到发布前添加项目图标.app启动图片的时候,一定要确定了这两项的所有图片不会更改了再去添加,否则更改已经添加好的加项目图标.app启动图片就会报错, 如果您报错了,百度之后也没有解决办法,那么就尝试在已经备份的项目中重新去添加图片就可以了.