Yesterday to do the project, wrote a method, the program suddenly reported connection is ReadOnly. Queries leading to data modification is not allowed the program half-day, and finally found that it was in the spring configuration file itself added transactions. The method is written in uppercase, but the spring configuration starts with lowercase
The code is as follows:
<BeanID= "Transactioninterceptor"class= "Org.springframework.transaction.interceptor.TransactionInterceptor"> < Propertyname= "TransactionManager"ref= "TransactionManager" /> < Propertyname= "Transactionattributes"> <Props> <propKey= "save*">Propagation_required</prop> <propKey= "update*">Propagation_required</prop> <propKey= "delete*">Propagation_required</prop> <propKey= "set*">Propagation_required</prop> <propKey= "change*">Propagation_required</prop> <propKey= "get*">ReadOnly</prop> <propKey="*">ReadOnly</prop> </Props> </ Property> </Bean>
Look at the red code, this is the configuration of the transaction, in the attribute key, I define the get*. means that the method name can only start with a Get name
And I wrote get, so I use the default transaction <prop key= "*" >READONLY</PROP>. So the newspaper connection is ReadOnly. Queries leading to data modification is not allowed
Oh, code specification naming
Spring transaction connection is read-only