Write operations are not allowed in read-only mode

報的錯誤如下:



Write operations are not allowed in read-only mode (FlushMode.NEVER/MANUAL): Turn your Session into FlushMode.COMMIT/AUTO or remove 'readOnly'marker from transaction definition.



解決辦法:

檢查發現自己的expression路徑與新加入的service路徑不同造成的


在以AspectJ方式定義AOP的時候, 會定義service的路徑 如:

<aop:pointcut expression="execution(* com.service.impl.*.*(..))"

id="allServicesMethod" />

如果新加的service不在execution的路徑中,並使用到了那個service,就會拋出上面所說的異常。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章