<!--Web Begin-->
<!--the path to the Web. XML Spring applicationcontext configuration file, you can use wildcards, multiple paths, separated by numbers--
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:/config/applicationContext.xml</param-value>
</context-param>
<!--Spring MVC Start--
<servlet>
<servlet-name>SpringMVC</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:/config/dispatcherServlet.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<!--Web End-->
<!--applicationcontext.xml automatic search @component, @Service, @Repository and other labeled classes do not search @controller class--
<!--automatic scanning components, here to remove the controller under the Web, they are configured in the Spring3-servlet.xml, if not removed will affect transaction management. -
<context:component-scan base-package= "Com.smart" annotation-config= "true" >
<context:exclude-filter type= "Annotation" expression= "Org.springframework.stereotype.Controller"/>
</context:component-scan>
<!--Dispatcherservlet.xml only the class that searches for @controller labels does not search the class of other labels--
<context:component-scan base-package= "Com.smart" use-default-filters= "false" >
<context:include-filter type= "Annotation" expression= "Org.springframework.stereotype.Controller"/>
</context:component-scan>
<!--C3P0 Database configuration--
<bean id= "c3p0" class= "Com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method= "Close" >
<property name= "Driverclass" value= "${mysql.jdbc.driverclassname}"/>
<property name= "Jdbcurl" value= "${mysql.jdbc.url}"/>
<property name= "user" value= "${mysql.jdbc.username}"/>
<property name= "Password" value= "${mysql.jdbc.password}"/>
<!--c3p0 The number of connections that are fetched at the same time when the connection in the connection pool is exhausted. Default:3--
<property name= "Acquireincrement" value= "5"/>
<!--defines the number of repeated attempts to obtain a new connection from the database after a failure. Default:30--
<property name= "acquireretryattempts" value= "/>"
<!--the interval between two connections, in milliseconds. default:1000--
<property name= "Acquireretrydelay" value= "/>"
< All uncommitted actions are rolled back by default when the connection is closed!--. Default:false--
<property name= "Autocommitonclose" value= "false"/>
<!--when the connection pool is exhausted, the client calls getconnection () to wait for the new connection, and after the timeout, the SQLException is thrown and, if set to 0, waits indefinitely. Unit milliseconds. Default:0--
<property name= "Checkouttimeout" value= "10000"/>
<!--check for idle connections in all connection pools every 60 seconds. Default:0--
<property name= "idleconnectiontestperiod" value= "/>"
<!--the number of connections obtained when initializing, the value should be between Minpoolsize and Maxpoolsize. Default:3--
<property name= "Initialpoolsize" value= "ten"/>
<!--the minimum number of connections that are kept in the connection pool--
<property name= "Minpoolsize" value= "5"/>
<!--The maximum number of connections that are kept in the connection pool. Default:15--
<property name= "maxpoolsize" value= "/>"
<!--maximum idle time, unused in 60 seconds, the connection is discarded. If 0, it will never be discarded. Default:0--
<property name= "maxidletime" value= "/>"
<!--C3P0 will build a blank table named Test and test it with its own query statement. If this parameter is defined, then the attribute preferredtestquery will be ignored. You cannot do anything on this test sheet, it will be used only for C3P0 testing. Default:null--
<property name= "automatictesttable" value= "c3p0_testtable"/>
<!--getting a connection failure will cause any thread that waits for the connection pool to get the connection to throw an exception. However, the data source is still valid and continues to try to get the connection the next time you call Getconnection (). If set to True, the data source will declare broken and permanently shut down after attempting to acquire a connection failure. Default:false--
<property name= "Breakafteracquirefailure" value= "false"/>
</bean>
<!--BONECP configuration--><!--
<bean id= "BONECP" class= "Com.jolbox.bonecp.BoneCPDataSource" destroy-method= "Close" >
<property name= "Driverclass" value= "${mysql.jdbc.driverclassname}"/>
<property name= "Jdbcurl" value= "${mysql.jdbc.url}"/>
<property name= "username" value= "${mysql.jdbc.username}"/>
<property name= "Password" value= "${mysql.jdbc.password}"/>
Check the time interval for idle connections in the database connection pool, in units of minutes, default: 240, set to 0 if you want to cancel
<property name= "idleconnectiontestperiodinminutes" value= "/>"
Maximum surviving time for unused links in the connection pool, in units of minutes, default: 60, if you want to live forever set to 0
<property name= "idlemaxageinminutes" value= "/>"
Maximum number of connections per partition
<property name= "maxconnectionsperpartition" value= "/>"
Minimum number of connections per partition
<property name= "Minconnectionsperpartition" value= "ten"/>
Number of partitions, default value 2, minimum 1, recommended 3-4, depending on application
<property name= "Partitioncount" value= "3"/>
Each time to get a database connection when you want to get a few, the default value: 2
<property name= "Acquireincrement" value= "5"/>
The size of the cache prepared statements, default value: 0
<property name= "statementscachesize" value= "/>"
The number of link attendant processes released per partition, default: 3, unless you do a lot of work during a database connection, excessive assistant processes can affect your performance
<property name= "Releasehelperthreads" value= "3"/>
</bean>
--><!--proxool configuration-->
<!--<bean id= "Proxool" class= " Org.logicalcobwebs.proxool.ProxoolDataSource "
<property name=" Driver "value=" ${ Mysql.jdbc.driverClassName} "/>
<property name=" Driverurl "value=" ${mysql.jdbc.url} "/>
< Property name= "User" value= "${mysql.jdbc.username}"/>
<property name= "password" value= "${ Mysql.jdbc.password} "/>
alias of data source
<property name=" Alias "value=" Proxool_alias "/>
Default number of idle connections is 0
<property name= "Prototypecount" value= "4"/>
Minimum number of connections (default 5)
<property name= "Minimumconnectioncount" Value= "1"/>
Maximum number of connections (default 15), exceeding the number of connections, waiting in queue when requested, maximum number of wait requests determined by Maximum-new-connections
<property name= "Maximumconnectioncount" value= "/>";
If the scout thread discovers an idle connection, the SQL statement is used to check for these connections
<property name= " Housekeepingtestsql "value=" select Current_date "/>
</bean>
--><!--dbcp configuration-->
<!--<bean id= "dbcp" class= "Org.apache.commons.dbcp.BasicDataSource" Destroy-method= "Close",
<property name= "Driverclassname" value= "${mysql.jdbc.driverclassname}"/>
<property name= "url" value= "${mysql.jdbc.url}"/>
<property name= "username" value= "${ Mysql.jdbc.username} "/>
<property name=" password "value=" ${mysql.jdbc.password} "/>
Initialization when connection pooling starts
<property name= "InitialSize" value= "1"/>
Connection pool maximum
<property name= "maxactive" value= "" "/>
Maximum idle value, when a peak time passes, the connection pool can slowly release a link that has not been used, and has been reduced to maxle until
<property name= "Maxidle" value= "2"/>
Minimum idle value, When the number of idle connections is less than the threshold, the connection pool will be pre-applied to some links, so as not to apply for the peak flood time to request
<property name= "Minidle" value= "1"/>
Run the interval for determining the connection timeout task, in milliseconds, The default is-1, which does not perform the task.
<property name= "Timebetweenevictionrunsmillis" value= "3600000"/>
the time-out period for the connection, which defaults to half an hour.
<property name= "Minevictableidletimemillis" value= "3600000"/>
</bean>
<bean id= "datasourceoracle" class= "Com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method= "Close" >
<property name= "Driverclass" value= "${datasource.driver}"/>
<property name= "Jdbcurl" value= "${datasource.url}"/>
<property name= "user" value= "${datasource.username}"/>
<property name= "Password" value= "${datasource.password}"/>
<property name= "acquireincrement" value= "${c3p0.acquireincrement}"/>
<property name= "initialpoolsize" value= "${c3p0.initialpoolsize}"/>
<property name= "minpoolsize" value= "${c3p0.minpoolsize}"/>
<property name= "maxpoolsize" value= "${c3p0.maxpoolsize}"/>
<property name= "MaxIdleTime" value= "${c3p0.maxidletime}"/>
<property name= "Idleconnectiontestperiod" value= "${c3p0.idleconnectiontestperiod}"/>
<property name= "maxstatements" value= "${c3p0.maxstatements}"/>
<property name= "Numhelperthreads" value= "${c3p0.numhelperthreads}"/>
<property name= "Preferredtestquery" value= "${c3p0.preferredtestquery}"/>
<property name= "Testconnectiononcheckout" value= "${c3p0.testconnectiononcheckout}"/>
</bean>
<bean id= "Datasourcemysql" class= "Com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method= "Close" >
<property name= "Driverclass" value= "Com.mysql.jdbc.Driver"/>
<property name= "Jdbcurl" value= "jdbc:mysql://172.31.108.178:3306/world?useunicode=true& Characterencoding=utf-8&zerodatetimebehavior=converttonull "/>
<property name= "User" value= "root"/>
<property name= "Password" value= "jp2011"/>
<property name= "acquireincrement" value= "${c3p0.acquireincrement}"/>
<property name= "initialpoolsize" value= "${c3p0.initialpoolsize}"/>
<property name= "minpoolsize" value= "${c3p0.minpoolsize}"/>
<property name= "maxpoolsize" value= "${c3p0.maxpoolsize}"/>
<property name= "MaxIdleTime" value= "${c3p0.maxidletime}"/>
<property name= "Idleconnectiontestperiod" value= "${c3p0.idleconnectiontestperiod}"/>
<property name= "maxstatements" value= "${c3p0.maxstatements}"/>
<property name= "Numhelperthreads" value= "${c3p0.numhelperthreads}"/>
<property name= "Preferredtestquery" value= "${c3p0.preferredtestquery}"/>
<property name= "Testconnectiononcheckout" value= "${c3p0.testconnectiononcheckout}"/>
</bean>
<!--Mongo Begin--
<!--define the MONGO object, which corresponds to the mongo,replica-set in the official MongoDB jar package to set the IP address and port of the cluster replica
<mongo:mongo id= "MONGO" replica-set= "${mongo.hostport}" >
<!--settings for some connection properties--
<mongo:options
Connections-per-host= "${mongo.connectionsperhost}"
Threads-allowed-to-block-for-connection-multiplier= "${mongo.threadsallowedtoblockforconnectionmultiplier}"
connect-timeout= "${mongo.connecttimeout}"
Max-wait-time= "${mongo.maxwaittime}"
auto-connect-retry= "${mongo.autoconnectretry}"
Socket-keep-alive= "${mongo.socketkeepalive}"
socket-timeout= "${mongo.sockettimeout}"
slave-ok= "${mongo.slaveok}"
Write-number= "1"
write-timeout= "0"
Write-fsync= "true"/>
</mongo:mongo>
<mongo:db-factory dbname= "Database" mongo-ref= "MONGO"/>
<bean id= "Mongotemplate" class= "Org.springframework.data.mongodb.core.MongoTemplate" >
<constructor-arg name= "MONGO" ref= "MONGO"/>
<constructor-arg name= "DatabaseName" value= "${mongo.databasename}"/>
<constructor-arg name= "username" value= "${mongo.username}"/>
<constructor-arg name= "Password" value= "${mongo.password}"/>
</bean>
Java EE database connection pool configuration Daquan