From f6db1cbcb2871f5571578173ea41e2918b952775 Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Mon, 27 Feb 2017 13:41:34 -0800 Subject: [PATCH 1/2] Extend Microsoft SQL Server detection Update Microsoft SQL Server detection logic to retain "SQL SERVER" support (just in case the server string is driver specific). See gh-8222 --- .../org/springframework/boot/jdbc/DatabaseDriver.java | 11 ++++++++++- .../boot/jdbc/DatabaseDriverTests.java | 2 ++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/spring-boot/src/main/java/org/springframework/boot/jdbc/DatabaseDriver.java b/spring-boot/src/main/java/org/springframework/boot/jdbc/DatabaseDriver.java index 1ba0178c86..8eb72835ba 100644 --- a/spring-boot/src/main/java/org/springframework/boot/jdbc/DatabaseDriver.java +++ b/spring-boot/src/main/java/org/springframework/boot/jdbc/DatabaseDriver.java @@ -101,7 +101,16 @@ public enum DatabaseDriver { * SQL Server. */ SQLSERVER("Microsoft SQL Server", "com.microsoft.sqlserver.jdbc.SQLServerDriver", - "com.microsoft.sqlserver.jdbc.SQLServerXADataSource", "SELECT 1"), + "com.microsoft.sqlserver.jdbc.SQLServerXADataSource", "SELECT 1") { + + @Override + protected boolean matchProductName(String productName) { + return super.matchProductName(productName) + || "SQL SERVER".equalsIgnoreCase(productName); + + } + + }, /** * Firebird. diff --git a/spring-boot/src/test/java/org/springframework/boot/jdbc/DatabaseDriverTests.java b/spring-boot/src/test/java/org/springframework/boot/jdbc/DatabaseDriverTests.java index bf31471edb..7b0f2301c0 100644 --- a/spring-boot/src/test/java/org/springframework/boot/jdbc/DatabaseDriverTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/jdbc/DatabaseDriverTests.java @@ -86,6 +86,8 @@ public class DatabaseDriverTests { .isEqualTo(DatabaseDriver.POSTGRESQL); assertThat(DatabaseDriver.fromProductName("Microsoft SQL Server")) .isEqualTo(DatabaseDriver.SQLSERVER); + assertThat(DatabaseDriver.fromProductName("SQL SERVER")) + .isEqualTo(DatabaseDriver.SQLSERVER); assertThat(DatabaseDriver.fromProductName("DB2")).isEqualTo(DatabaseDriver.DB2); assertThat(DatabaseDriver.fromProductName("Firebird 2.5.WI")) .isEqualTo(DatabaseDriver.FIREBIRD); From 47b00c086ce199823dc6045575a750473daf81c1 Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Mon, 27 Feb 2017 13:56:17 -0800 Subject: [PATCH 2/2] Polish --- .../java/org/springframework/boot/actuate/health/Status.java | 2 +- .../boot/actuate/health/MongoHealthIndicatorTests.java | 2 +- .../autoconfigure/liquibase/LiquibaseAutoConfiguration.java | 4 ++-- spring-boot-docs/src/main/asciidoc/howto.adoc | 2 +- .../boot/starter/StarterDependenciesIntegrationTests.java | 2 +- .../devtools/SampleDevToolsApplicationIntegrationTests.java | 2 +- .../metadata/ConfigurationMetadata.java | 2 +- .../context/embedded/jetty/JettyEmbeddedServletContainer.java | 2 +- .../embedded/tomcat/TomcatEmbeddedServletContainer.java | 2 +- .../embedded/undertow/UndertowEmbeddedServletContainer.java | 2 +- .../springframework/boot/diagnostics/FailureAnalyzers.java | 2 +- .../java/org/springframework/boot/SpringApplicationTests.java | 2 +- .../boot/diagnostics/FailureAnalyzersTests.java | 2 +- 13 files changed, 14 insertions(+), 14 deletions(-) diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/Status.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/Status.java index d4c189e102..c3a5d89b70 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/Status.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/Status.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2014 the original author or authors. + * Copyright 2012-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/MongoHealthIndicatorTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/MongoHealthIndicatorTests.java index 4110b222d8..0b87c76b61 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/MongoHealthIndicatorTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/MongoHealthIndicatorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfiguration.java index 8f525258e1..46abc3f268 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfiguration.java @@ -78,11 +78,11 @@ public class LiquibaseAutoConfiguration { public LiquibaseConfiguration(LiquibaseProperties properties, ResourceLoader resourceLoader, ObjectProvider dataSourceProvider, - @LiquibaseDataSource ObjectProvider liquibaseDataSourceProvider) { + @LiquibaseDataSource ObjectProvider liquibaseDataSource) { this.properties = properties; this.resourceLoader = resourceLoader; this.dataSource = dataSourceProvider.getIfUnique(); - this.liquibaseDataSource = liquibaseDataSourceProvider.getIfAvailable(); + this.liquibaseDataSource = liquibaseDataSource.getIfAvailable(); } @PostConstruct diff --git a/spring-boot-docs/src/main/asciidoc/howto.adoc b/spring-boot-docs/src/main/asciidoc/howto.adoc index a4a57ad507..0451c16423 100644 --- a/spring-boot-docs/src/main/asciidoc/howto.adoc +++ b/spring-boot-docs/src/main/asciidoc/howto.adoc @@ -2264,7 +2264,7 @@ your application defines, if any. NOTE: By default, batch applications require a `DataSource` to store job details. If you want to deviate from that, you'll need to implement `BatchConfigurer`, see {spring-batch-javadoc}/core/configuration/annotation/EnableBatchProcessing.html[The -Javadoc of @EnableBatchProcessing] for more details. +Javadoc of `@EnableBatchProcessing`] for more details. diff --git a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/starter/StarterDependenciesIntegrationTests.java b/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/starter/StarterDependenciesIntegrationTests.java index 41df17e4c7..f19197b976 100644 --- a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/starter/StarterDependenciesIntegrationTests.java +++ b/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/starter/StarterDependenciesIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 the original author or authors. + * Copyright 2012-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-boot-samples/spring-boot-sample-devtools/src/test/java/sample/devtools/SampleDevToolsApplicationIntegrationTests.java b/spring-boot-samples/spring-boot-sample-devtools/src/test/java/sample/devtools/SampleDevToolsApplicationIntegrationTests.java index 359a86c3bb..35bc55a21f 100644 --- a/spring-boot-samples/spring-boot-sample-devtools/src/test/java/sample/devtools/SampleDevToolsApplicationIntegrationTests.java +++ b/spring-boot-samples/spring-boot-sample-devtools/src/test/java/sample/devtools/SampleDevToolsApplicationIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 the original author or authors. + * Copyright 2012-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/metadata/ConfigurationMetadata.java b/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/metadata/ConfigurationMetadata.java index 2144292fd0..f703f9e5b2 100644 --- a/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/metadata/ConfigurationMetadata.java +++ b/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/metadata/ConfigurationMetadata.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/jetty/JettyEmbeddedServletContainer.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/jetty/JettyEmbeddedServletContainer.java index b3104910f5..a52a789078 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/jetty/JettyEmbeddedServletContainer.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/jetty/JettyEmbeddedServletContainer.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/TomcatEmbeddedServletContainer.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/TomcatEmbeddedServletContainer.java index 1969089d31..27ab3dc021 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/TomcatEmbeddedServletContainer.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/TomcatEmbeddedServletContainer.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/undertow/UndertowEmbeddedServletContainer.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/undertow/UndertowEmbeddedServletContainer.java index 798324c884..4f7dbbf826 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/undertow/UndertowEmbeddedServletContainer.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/undertow/UndertowEmbeddedServletContainer.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-boot/src/main/java/org/springframework/boot/diagnostics/FailureAnalyzers.java b/spring-boot/src/main/java/org/springframework/boot/diagnostics/FailureAnalyzers.java index e5a5da3acb..35b207d0e7 100644 --- a/spring-boot/src/main/java/org/springframework/boot/diagnostics/FailureAnalyzers.java +++ b/spring-boot/src/main/java/org/springframework/boot/diagnostics/FailureAnalyzers.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-boot/src/test/java/org/springframework/boot/SpringApplicationTests.java b/spring-boot/src/test/java/org/springframework/boot/SpringApplicationTests.java index ba3ea541fd..c970d4017f 100644 --- a/spring-boot/src/test/java/org/springframework/boot/SpringApplicationTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/SpringApplicationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-boot/src/test/java/org/springframework/boot/diagnostics/FailureAnalyzersTests.java b/spring-boot/src/test/java/org/springframework/boot/diagnostics/FailureAnalyzersTests.java index 2b1c6fdcb4..423d071e11 100644 --- a/spring-boot/src/test/java/org/springframework/boot/diagnostics/FailureAnalyzersTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/diagnostics/FailureAnalyzersTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License.