2008-12-18 2 views

Antwort

6

Leider müssen Sie die dataSource spring Bean für sich selbst konfigurieren, wenn Sie mehr Kontrolle darüber haben möchten. Dies kann durch die Definition der Bohne in "Grails-app/conf/Frühjahr/resources.groovy"

beans = { 

    dataSource(org.apache.commons.dbcp.BasicDataSource) { 
     driverClassName = "com.mysql.jdbc.Driver" 
     username = "someuser" 
     password = "s3cret" 
     initialSize = 15 
     maxActive = 50 
     maxIdle = 15 
    } 

} 

Es überschreibt den Standard Grails Datasource durchgeführt werden, die in „Grails-app/conf/DataSource.groovy konfiguriert ist, ".


Wahrscheinlich sollte es auch DataSource.groovy Konfiguration wie dies die PropertyOverrideConfigurer der Nutzung der Pool-Größe Eigenschaften des Standard grails außer Kraft arbeiten, um (in Config.groovy):

beans = { 
    dataSource.initialSize = 15 
    dataSource.maxActive = 50 
    dataSource.maxIdle = 15 
} 
3

Für Grails 1.2 Sie sollte ein etwas anderes Format verwenden:

dataSource { 
    pooled = true 
    dbCreate = "update" 
    url = "jdbc:mysql://localhost/yourDB" 
    driverClassName = "com.mysql.jdbc.Driver" 
    username = "yourUser" 
    password = "yourPassword" 
    properties { 
     maxActive = 50 
     maxIdle = 25 
     minIdle = 5 
     initialSize = 5 
     minEvictableIdleTimeMillis = 60000 
     timeBetweenEvictionRunsMillis = 60000 
     maxWait = 10000  
    } 
}