Skip to content

Commit 2cf93f8

Browse files
committed
Polish
1 parent daf6be4 commit 2cf93f8

File tree

11 files changed

+28
-40
lines changed

11 files changed

+28
-40
lines changed

spring-boot-dependencies/pom.xml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
<?xml version="1.0" encoding="UTF-8"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
24
<modelVersion>4.0.0</modelVersion>
35
<groupId>org.springframework.boot</groupId>
46
<artifactId>spring-boot-dependencies</artifactId>
@@ -1961,9 +1963,9 @@
19611963
<version>${mongodb.version}</version>
19621964
</dependency>
19631965
<dependency>
1964-
<groupId>org.mortbay.jasper</groupId>
1965-
<artifactId>apache-el</artifactId>
1966-
<version>${jetty-el.version}</version>
1966+
<groupId>org.mortbay.jasper</groupId>
1967+
<artifactId>apache-el</artifactId>
1968+
<version>${jetty-el.version}</version>
19671969
</dependency>
19681970
<dependency>
19691971
<groupId>org.neo4j</groupId>
@@ -2669,4 +2671,4 @@
26692671
<id>integration-test</id>
26702672
</profile>
26712673
</profiles>
2672-
</project>
2674+
</project>

spring-boot-docs/src/main/asciidoc/howto.adoc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1732,11 +1732,10 @@ You can apply the same principle if you are configuring a custom JNDI `DataSourc
17321732
}
17331733
----
17341734

1735-
1736-
Spring Boot also provides a utility builder class `DataSourceBuilder` that can be used
1737-
to create one of the standard data sources (if it is on the classpath). The builder can
1738-
detect the one to use based on the ones available on the classpath and it also auto
1739-
detects the driver based on the JDBC url.
1735+
Spring Boot also provides a utility builder class `DataSourceBuilder` that can be used to
1736+
create one of the standard data sources (if it is on the classpath). The builder can
1737+
detect the one to use based on what's available on the classpath. It also auto detects the
1738+
driver based on the JDBC url.
17401739

17411740
[source,java,indent=0,subs="verbatim,quotes,attributes"]
17421741
----
@@ -1759,7 +1758,7 @@ There is a catch however. Because the actual type of the connection pool is not
17591758
no keys are generated in the metadata for your custom `DataSource` and no completion is
17601759
available in your IDE (The `DataSource` interface doesn't expose any property). Also, if
17611760
you happen to _only_ have Hikari on the classpath, this basic setup will not work because
1762-
Hikari has no `url` parameter (but a `jdbcUrl` parameter). You should have to rewrite
1761+
Hikari has no `url` parameter (but a `jdbcUrl` parameter). You will have to rewrite
17631762
your configuration as follows:
17641763

17651764
[source,properties,indent=0]
@@ -1861,6 +1860,7 @@ This final example configures two data sources on custom namespaces with the sam
18611860
than what Spring Boot would do in auto-configuration.
18621861

18631862

1863+
18641864
[[howto-use-spring-data-repositories]]
18651865
=== Use Spring Data repositories
18661866
Spring Data can create implementations for you of `@Repository` interfaces of various

spring-boot-docs/src/main/java/org/springframework/boot/jdbc/BasicDataSourceExample.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,5 @@ public DataSource dataSource() {
4545
// end::configuration[]
4646

4747
}
48+
4849
}

spring-boot-docs/src/main/java/org/springframework/boot/jdbc/CompleteTwoDataSourcesExample.java

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
import org.springframework.context.annotation.Primary;
2626

2727
/**
28-
* Example configuration for configuring two data sources with what Spring Boot does
29-
* in auto-configuration.
28+
* Example configuration for configuring two data sources with what Spring Boot does in
29+
* auto-configuration.
3030
*
3131
* @author Stephane Nicoll
3232
*/
@@ -50,9 +50,7 @@ public DataSourceProperties fooDataSourceProperties() {
5050
@Primary
5151
@ConfigurationProperties("app.datasource.foo")
5252
public DataSource fooDataSource() {
53-
return fooDataSourceProperties()
54-
.initializeDataSourceBuilder()
55-
.build();
53+
return fooDataSourceProperties().initializeDataSourceBuilder().build();
5654
}
5755

5856
@Bean
@@ -61,13 +59,10 @@ public DataSourceProperties barDataSourceProperties() {
6159
return new DataSourceProperties();
6260
}
6361

64-
6562
@Bean
6663
@ConfigurationProperties("app.datasource.bar")
6764
public DataSource barDataSource() {
68-
return barDataSourceProperties()
69-
.initializeDataSourceBuilder()
70-
.build();
65+
return barDataSourceProperties().initializeDataSourceBuilder().build();
7166
}
7267
// end::configuration[]
7368

spring-boot-docs/src/main/java/org/springframework/boot/jdbc/ConfigurableDataSourceExample.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,10 @@ public DataSourceProperties dataSourceProperties() {
5252
@ConfigurationProperties("app.datasource")
5353
public HikariDataSource dataSource(DataSourceProperties properties) {
5454
return (HikariDataSource) properties.initializeDataSourceBuilder()
55-
.type(HikariDataSource.class)
56-
.build();
55+
.type(HikariDataSource.class).build();
5756
}
5857
// end::configuration[]
5958

6059
}
60+
6161
}

spring-boot-docs/src/main/java/org/springframework/boot/jdbc/SimpleDataSourceExample.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@ static class SimpleDataSourceConfiguration {
4343
@ConfigurationProperties("app.datasource")
4444
public HikariDataSource dataSource() {
4545
return (HikariDataSource) DataSourceBuilder.create()
46-
.type(HikariDataSource.class)
47-
.build();
46+
.type(HikariDataSource.class).build();
4847
}
4948
// end::configuration[]
5049

spring-boot-docs/src/main/java/org/springframework/boot/jdbc/SimpleTwoDataSourcesExample.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,18 +53,14 @@ public DataSourceProperties fooDataSourceProperties() {
5353
@Primary
5454
@ConfigurationProperties("app.datasource.foo")
5555
public DataSource fooDataSource() {
56-
return fooDataSourceProperties()
57-
.initializeDataSourceBuilder()
58-
.build();
56+
return fooDataSourceProperties().initializeDataSourceBuilder().build();
5957
}
6058

61-
6259
@Bean
6360
@ConfigurationProperties("app.datasource.bar")
6461
public BasicDataSource barDataSource() {
6562
return (BasicDataSource) DataSourceBuilder.create()
66-
.type(BasicDataSource.class)
67-
.build();
63+
.type(BasicDataSource.class).build();
6864
}
6965
// end::configuration[]
7066

spring-boot-docs/src/test/java/org/springframework/boot/jdbc/BasicDataSourceExampleTests.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333

3434
/**
3535
* Test for {@link BasicDataSourceExample}.
36+
*
3637
* @author Stephane Nicoll
3738
*/
3839
@RunWith(SpringRunner.class)

spring-boot-docs/src/test/java/org/springframework/boot/jdbc/CompleteTwoDataSourcesExampleTests.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,10 @@ public class CompleteTwoDataSourcesExampleTests {
4747
@Test
4848
public void validateConfiguration() throws SQLException {
4949
assertThat(this.context.getBeansOfType(DataSource.class)).hasSize(2);
50-
5150
DataSource dataSource = this.context.getBean(DataSource.class);
5251
assertThat(this.context.getBean("fooDataSource")).isSameAs(dataSource);
5352
assertThat(dataSource.getConnection().getMetaData().getURL())
5453
.startsWith("jdbc:h2:mem:");
55-
5654
DataSource barDataSource = this.context.getBean("barDataSource",
5755
DataSource.class);
5856
assertThat(barDataSource.getConnection().getMetaData().getURL())

spring-boot-docs/src/test/java/org/springframework/boot/jdbc/SampleApp.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
2424

2525
/**
26-
* A sample {@link SpringBootConfiguration} that only enables the auto-configuration
27-
* for the {@link DataSource}.
26+
* A sample {@link SpringBootConfiguration} that only enables the auto-configuration for
27+
* the {@link DataSource}.
2828
*
2929
* @author Stephane Nicoll
3030
*/

0 commit comments

Comments
 (0)