I have two grails servers:
The problem: How do I make the Web's domain objects read only in one place (config file) for the entire run of the application, instead of writing caching: 'read-only' for each domain class' mapping.
Para-phrased from http://www.nabble.com/database-read-only-td20360158.html
If you have pooled=true in DataSource.groovy this creates a org.apache.commons.dbcp.BasicDataSource. You can set the defaultReadOnly property in the BootStrap.groovy:
class BootStrap {
def dataSource
def init = { servletContext ->
dataSource.defaultReadOnly = true
}
def destroy = {}
}
with grails 1.3.7
use [dataSourceUnproxied] instead of [dataSource]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.