1.org.springframework.dao.InvalidDataAccessApiUsageException: 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.
执行的方法不再设置范围内,hibernate默认为readonly:解决方案,将方法对应的包移动至com.document包下
<aop:config>
<aop:pointcut id="bussinessService"
expression="execution(public * com.document..*.*(..))" />
<aop:advisor pointcut-ref="bussinessService"
advice-ref="txAdvice" />
</aop:config>
<tx:advice id="txAdvice" transaction-manager="txManager">
<tx:attributes>
<!-- <tx:method name="getUser" read-only="true" /> -->
<!-- <tx:method name="add*" propagation="REQUIRED"/> -->
<tx:method name="*" propagation="REQUIRED"/>
</tx:attributes>
</tx:advice>