@@ -2315,19 +2315,37 @@ DataSource configuration is controlled by external configuration properties in
2315
2315
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
2316
2316
----
2317
2317
2318
- See {sc-spring-boot-autoconfigure}/jdbc/DataSourceProperties.{sc-ext}[`DataSourceProperties`]
2319
- for more of the supported options. Note also that you can configure any of the
2320
- `DataSource` implementation specific properties via `+spring.datasource.*+`: refer to the
2321
- documentation of the connection pool implementation you are using for more details.
2322
-
2323
2318
TIP: You often won't need to specify the `driver-class-name` since Spring boot can deduce
2324
2319
it for most databases from the `url`.
2325
2320
2326
2321
NOTE: For a pooling `DataSource` to be created we need to be able to verify that a valid
2327
2322
`Driver` class is available, so we check for that before doing anything. I.e. if you set
2328
- `spring.datasource.driverClassName =com.mysql.jdbc.Driver` then that class has to be
2323
+ `spring.datasource.driver-class-name =com.mysql.jdbc.Driver` then that class has to be
2329
2324
loadable.
2330
2325
2326
+ See {sc-spring-boot-autoconfigure}/jdbc/DataSourceProperties.{sc-ext}[`DataSourceProperties`]
2327
+ for more of the supported options. These are the standard options that work regardless of
2328
+ the actual implementation. It is also possible to fine tune implementation-specific settings
2329
+ using the `+spring.datasource.*+` prefix, refer to the documentation of the connection pool
2330
+ implementation you are using for more details.
2331
+
2332
+ For instance, if you are using the
2333
+ http://tomcat.apache.org/tomcat-8.0-doc/jdbc-pool.html#Common_Attributes[Tomcat connection pool]
2334
+ you could customize many additional settings:
2335
+
2336
+
2337
+ [source,properties,indent=0]
2338
+ ----
2339
+ # Number of ms to wait before throwing an exception if no connection is available.
2340
+ spring.datasource.max-wait=10000
2341
+
2342
+ # Maximum number of active connections that can be allocated from this pool at the same time.
2343
+ spring.datasource.max-active=50
2344
+
2345
+ # Validate the connection before borrowing it from the pool.
2346
+ spring.datasource.test-on-borrow=true
2347
+ ----
2348
+
2331
2349
2332
2350
2333
2351
[[boot-features-connecting-to-a-jndi-datasource]]
0 commit comments