SpringMvc + Cloud SQL (MySQL) 集成

SpringMvc + Cloud SQL (MySQL) integration

在我的项目中,我们计划使用 google 云 SQL。但是我没有完成此操作的完整步骤。我已经在云 SQL shell 中创建了一个数据库和 table。我需要如何从 spring MVC 项目连接该数据库?请给出执行此操作的明确步骤。

您可以关注 this official documentation by Spring Cloud for Google Cloud Platform which provides code samples and examples. What you want to do is described in this link for MySQL or in this link for PostgreSQL。

还有这个 community's tutorial 可以指导您在 App Engine 柔性环境中创建 Spring 带有云 SQL 的启动应用程序。

我还找到了 this 文章,它不是官方文档,但它可以帮助您更好地理解在项目中处理 Cloud SQL 的方式。