所用框架ssm,数据库是mysql
最近在学习springmvc的时候,做文件下载的时候遇到了Connection is read-only. Queries leading to data modification are not allowed
网上查找原因发现是因为自己在spring配置文件中增加了事务管理,,这里我给业务层com.study.service.impl包下所有的类和方法添加了事物,除了已insert* 、delete*和update*方法开头的方法事务不是只读的其他都是只读的,
applicationContext.xml详细配置如下
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:util="http://www.springframework.org/schema/util"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.2.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.2.xsd
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util-3.2.xsd
http://www.springframework.org/schema/tx