无法检测数据库类型

Mar*_*que 8 spring-batch spring-boot

我正在尝试使用sqljdbc4驱动程序和以下配置创建一个 Spring Boot 应用程序:

spring:
  datasource:
    url: "jdbc:sqlserver://dbhost:1433;databaseName=test"
    username: dbuser
    password: dbuser
    tomcat:
      test-on-borrow: true
      validation-query: select 1
Run Code Online (Sandbox Code Playgroud)

但是,当我运行时,我收到此错误:Unable to detect database type

我正在调试BatchDatabaseInitializer,错误来自哪里,当它调用时JdbcUtils.commonDatabaseName(...),返回“Microsoft SQL Server”作为产品名称,与任何 DatabaseDriver 的产品名称都不匹配。

我尝试了其他驱动程序,但他们都有同样的问题。

这是一个错误吗?

我正在使用 Spring Boot 1.5.1-RELEASE。

小智 1

将其添加到您的应用程序文件中的main函数中。

@SpringBootApplication(
        exclude = {
                BatchAutoConfiguration.class,
                JmxAutoConfiguration.class
        },
        excludeName = {
                "org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration",
        }
)
Run Code Online (Sandbox Code Playgroud)