百度统计网站速度诊断工具,合肥住房和城乡建设局,威海优化推广,双柏县住房和城乡建设局网站昨天做项目时#xff0c;写了个方法,程序突然报了Connection is readonly. Queries leading to data modification are not allowed调了程序半天#xff0c;最后才发现是自己在spring配置文件中增加了事务.把方法写成了大写开头了#xff0c;但是spring配置是以小写开头 代码…昨天做项目时写了个方法,程序突然报了Connection is readonly. Queries leading to data modification are not allowed调了程序半天最后才发现是自己在spring配置文件中增加了事务.把方法写成了大写开头了但是spring配置是以小写开头 代码如下 bean idtransactionInterceptor classorg.springframework.transaction.interceptor.TransactionInterceptorproperty nametransactionManager reftransactionManager /property nametransactionAttributespropsprop keysave*PROPAGATION_REQUIRED/propprop keyupdate*PROPAGATION_REQUIRED/propprop keydelete*PROPAGATION_REQUIRED/propprop keyset*PROPAGATION_REQUIRED/prop prop keychange*PROPAGATION_REQUIRED/prop prop keyget*readOnly/propprop key*readOnly/prop/props/property/bean 大家看下红色代码,这就是事务的配置, 在属性key中我定义了get*.意思是方法名只能是以get名称开头 而我却写成了Get 了,这样就使用默认事务了prop key*readOnly/prop所以报Connection is readonly. Queries leading to data modification are not allowed 呵呵代码规范命名转载于:https://www.cnblogs.com/toSeeMyDream/p/4510551.html
相关文章: