Roberto Perez Alcolea
Roberto Perez Alcolea

Reputation: 1414

Datasource avanced properties

I just wondering is this is a valid DataSource configuration:

development {
        properties {
            maxActive = 50
            maxIdle = 25
            minIdle = 5
            initialSize = 8
            minEvictableIdleTimeMillis = 1000 * 15 * 60
            timeBetweenEvictionRunsMillis = 1000 * 15 * 60
            maxWait = 10000
            validationQuery = "/* ping */"
        }
        dataSource {
            username = "test"
            password = "test"
            dbCreate = "update" // one of 'create', 'create-drop', 'update', 'validate', ''
            url = "jdbc:mysql://params"
        }

    }

If i have this, do the dataSource use the properties listed above?

Upvotes: 0

Views: 86

Answers (2)

James Kleeh
James Kleeh

Reputation: 12238

If you want to centralize your properties, you can define the datasource without an enviornment first:

dataSource {
  properties {
  }
}

development {
  dataSource {
  }
}

Upvotes: 3

dmahapatro
dmahapatro

Reputation: 50285

properties is part of the datasource bean (of type BasicDataSource). Using DSL makes it easier not to use the accessor methods explicitly to set/get the members.

So I think you have to stick to

development{
   dataSource{
      ......
      properties{
         .......
      }
   }
}

Upvotes: 1

Related Questions