You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Spring Boot 3.3升级:@Transactional与AspectJ织入问题求助

升级Spring Boot 3.3后AspectJ事务失效及日志问题

背景

  • 应用原基于Spring Boot 3.2,使用@EnableTransactionManagement(mode = AdviceMode.ASPECTJ)配置事务处理(因存在事务方法自调用场景,默认代理模式不支持该特性)
  • 升级至Spring Boot 3.3版本后,@Transactional注解完全失效,项目原使用JCABI Aspect Plugin,构建时出现Micrometer相关的AspectJ语法错误

构建错误日志

Tue Jan 14 02:13:41 IST 2025
io/micrometer/observation/aop/ObservedAspect.java [error] Invalid pointcut '@within(io.micrometer.observation.annotation.Observed) and not @annotation(io.micrometer.observation.annotation.Observed)': org.aspectj.weaver.patterns.ParserException: unexpected pointcut element: and@55:57 at position 55

<Unknown> [warning] Found @DeclareAnnotation while current release does not support it (see 'org.aspectj.weaver.bcel.AtAjAttributes')

io/micrometer/observation/aop/ObservedAspect.java [error] Invalid pointcut '@within(io.micrometer.observation.annotation.Observed) and not @annotation(io.micrometer.observation.annotation.Observed)': org.aspectj.weaver.patterns.ParserException: unexpected pointcut element: and@55:57 at position 55

<Unknown> [warning] Found @DeclareAnnotation while current release does not support it (see 'org.aspectj.weaver.bcel.AtAjAttributes')

已尝试操作

  • 将Micrometer依赖降级至Spring Boot 3.2配套的1.12.13版本后,应用可正常运行,但希望通过替换JCABI Plugin为最新替代方案解决问题,而非依赖降级

当前运行时错误

jakarta.persistence.TransactionRequiredException: No EntityManager with actual transaction available for current thread - cannot reliably process 'persist' call

额外问题

  • Maven构建过程仅打印基础日志,无法看到事务方法的AspectJ织入细节日志,也无法将日志导出到文件

核心疑问

  1. 如何解决上述jakarta.persistence.TransactionRequiredException异常?
  2. 如何启用并导出详细的AspectJ织入日志?

内容的提问来源于stack exchange,提问作者Nitin Kumar

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.14 23:36:08