今天发现这样的问题异常:
org.springframework.dao.InvalidDataAccessApiUsageException: Write operations are not allowed in read-only mode (FlushMode.NEVER) - turn your Session into FlushMode.AUTO or remove 'readOnly' marker from transaction definition
网上有很多说法,我都一一修改过,始终出现上面的exception,后来猛然想起。。。
原因:
spring的配置文件有:
<!-- 以AspectJ方式 定义 AOP -->
<aop:config proxy-target-class="true">
<aop:advisor pointcut="execution(* com.**.service.*.*(..))" advice-ref="txAdvice"/>
</aop:config>
因为新的service类的路径与aop:config下的配置不匹配 可能是这个路径不对造成的...
org.springframework.dao.InvalidDataAccessApiUsageException: Write operations are not allowed in read-only mode (FlushMode.NEVER) - turn your Session into FlushMode.AUTO or remove 'readOnly' marker from transaction definition
网上有很多说法,我都一一修改过,始终出现上面的exception,后来猛然想起。。。
原因:
spring的配置文件有:
<!-- 以AspectJ方式 定义 AOP -->
<aop:config proxy-target-class="true">
<aop:advisor pointcut="execution(* com.**.service.*.*(..))" advice-ref="txAdvice"/>
</aop:config>
因为新的service类的路径与aop:config下的配置不匹配 可能是这个路径不对造成的...
本文探讨了在使用Spring框架时遇到的InvalidDataAccessApiUsageException异常问题,重点在于AOP配置路径与实际服务类路径不匹配的情况。通过分析问题原因,提出解决方案,帮助开发者避免此类错误。
823

被折叠的 条评论
为什么被折叠?



