Skip to content

Commit aa4282d

Browse files
committed
1 parent 34f0c27 commit aa4282d

File tree

2 files changed

+10
-14
lines changed

2 files changed

+10
-14
lines changed

framework-docs/src/main/kotlin/org/springframework/docs/dataaccess/jdbc/jdbcdatasource/BasicDataSourceConfiguration.kt

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,11 @@ class BasicDataSourceConfiguration {
99

1010
// tag::dataSourceBean[]
1111
@Bean(destroyMethod = "close")
12-
fun dataSource(): BasicDataSource {
13-
val dataSource = BasicDataSource()
14-
dataSource.driverClassName = "org.hsqldb.jdbcDriver"
15-
dataSource.url = "jdbc:hsqldb:hsql://localhost:"
16-
dataSource.username = "sa"
17-
dataSource.password = ""
18-
return dataSource
12+
fun dataSource() = BasicDataSource().apply {
13+
driverClassName = "org.hsqldb.jdbcDriver"
14+
url = "jdbc:hsqldb:hsql://localhost:"
15+
username = "sa"
16+
password = ""
1917
}
2018
// end::dataSourceBean[]
2119
}

framework-docs/src/main/kotlin/org/springframework/docs/dataaccess/jdbc/jdbcdatasource/ComboPooledDataSourceConfiguration.kt

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,11 @@ internal class ComboPooledDataSourceConfiguration {
99

1010
// tag::dataSourceBean[]
1111
@Bean(destroyMethod = "close")
12-
fun dataSource(): ComboPooledDataSource {
13-
val dataSource = ComboPooledDataSource()
14-
dataSource.driverClass = "org.hsqldb.jdbcDriver"
15-
dataSource.jdbcUrl = "jdbc:hsqldb:hsql://localhost:"
16-
dataSource.user = "sa"
17-
dataSource.password = ""
18-
return dataSource
12+
fun dataSource() = ComboPooledDataSource().apply {
13+
driverClass = "org.hsqldb.jdbcDriver"
14+
jdbcUrl = "jdbc:hsqldb:hsql://localhost:"
15+
user = "sa"
16+
password = ""
1917
}
2018
// end::dataSourceBean[]
2119

0 commit comments

Comments
 (0)