如何通过使用gradle的spring应用程序检测我是否使用MySQL数据库?

时间:2016-11-07 17:39:08

标签: mysql spring-boot boxfuse

我在这里遵循了春季教程:https://spring.io/guides/gs/rest-service/并让它发挥作用。然后我按照连接MySQL DB的教程,在build.gradle中添加了依赖项。 boxfuse似乎没有检测到它。

MacBook-Pro-2 ~/work/test/server (develop) $ boxfuse info
Boxfuse client v.1.22.2.1149
Copyright 2016 Boxfuse GmbH. All rights reserved.

Account: ...

Info about ... in the dev environment:

App Type    : Single Instance (Elastic IP)
App URL     : 
DB Type     : No database
Logs Type   : No centralized logging

在我的build.gradle文件中,我只有:

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:1.4.1.RELEASE")
        classpath 'mysql:mysql-connector-java:5.1.16'
    }
}

dependencies {
    compile("org.springframework.boot:spring-boot-starter-web")
    testCompile('org.springframework.boot:spring-boot-starter-test')
    compile('mysql:mysql-connector-java:5.1.16')
}

我是否错过了让这项工作成功的步骤?

编辑: 我试过" boxfuse info"在http://start.spring.io/使用入门项目工具并选择了JDBC和MySQL的依赖项:

enter image description here

编译到jar并在jar所在的构建目录中运行boxfuse。它仍然没有检测到数据库。

1 个答案:

答案 0 :(得分:0)

如果以前创建的应用程序db.type设置为none,那么您需要销毁并重新创建它以再次触发自动检测并更改数据库类型。为此,请转到项目目录并发出

$ boxfuse destroy $ gradle build $ boxfuse create

Boxfuse将在部署时正确选择MySQL驱动程序并在每个环境中自动配置数据库。