<BeanID= "DataSource"class= "Com.alibaba.druid.pool.DruidDataSource"Init-method= "Init"Destroy-method= "Close">< Propertyname= "url"value= "${datasource.url}" />< Propertyname= "username"value= "${datasource.name}" />< Propertyname= "Password"value= "${datasource.password}" />< Propertyname= "ConnectionProperties"value= "Config.decrypt=true" />< Propertyname= "Filters"value= "config,log4j" />< Propertyname= "Maxactive"value= "${datasource.maxactive}" />< Propertyname= "InitialSize"value= "${datasource.initialisize}" />< Propertyname= "Maxwait"value= "60000" />< Propertyname= "Minidle"value= "1" />< Propertyname= "Timebetweenevictionrunsmillis"value= "60000" />< Propertyname= "Minevictableidletimemillis"value= "300000" />< Propertyname= "Validationquery"value= "Select ' x ' from dual" />< Propertyname= "Testwhileidle"value= "true" />< Propertyname= "Testonborrow"value= "false" />< Propertyname= "Testonreturn"value= "false" />< Propertyname= "Poolpreparedstatements"value= "true" />< Propertyname= "Maxpoolpreparedstatementperconnectionsize"value= " the" /></Bean>
ConnectionProperties: Configure some properties of the connection, where the config.decrypt=true is configured to indicate that the supplied password is encrypted
Filters: is an interceptor, configurable monitoring, logging, etc.
Maxactive: Maximum number of connections
InitialSize: Initialize the number of connections
Minidle: Number of idle connections
Maxwait: Get connection Maximum wait time
Timebetweenevictionrunsmillis: Detection of connection time, per millisecond
Minevictableidletimemillis: Detects that a connection is not closed is greater than this value closes the connection, in milliseconds
Validationquery: This SQL statement verifies that the database is available at system startup, such as Oracle with SELECT ' X ' from Dual,mysql with select ' X '
Testwhileidle: Enable idle connection detection for recycling
Testonborrow: If connection availability is detected when getting connections from the connection pool, there is a slight impact on the performance of the switch
Testonreturn: If connection availability is detected when connecting to the connection pool, turn on performance can be somewhat affected
Poolpreparedstatements: Turn on Pscache Cache, Oracle set to True, non-Oracle set to False
Maxpoolpreparedstatementperconnectionsize: Maximum cache count, non-Oracle set to 0
Druid Data Source configuration