我已将mssql配置为pcf中用户提供的服务。用springboot和flywaydb创建了一个Java应用程序进行迁移。当我尝试将Java应用程序部署到pcf中时,出现错误“引起原因:org.flywaydb.core.api.FlywayException:无法连接到数据库。配置url,用户和密码!”。已经将我的应用程序绑定到mssql服务,并在pcf中重新启动了该应用程序,但仍然是相同的错误。
application.properties
spring.datasource.url=${vcap.services.db.credentials.jdbcUrl}
spring.datasource.username=${vcap.services.db.credentials.username}
spring.datasource.password=${vcap.services.db.credentials.password}
spring.datasource.driverClassName=com.microsoft.sqlserver.jdbc.SQLServerDriver
spring.jpa.show-sql=true
spring.jpa.hibernate.dialect=org.hibernate.dialect.SQLServer2012Dialect
pcf中的mssql配置
uri:sqlserver:// xxx:yyy @ zzz:1433 / db
用户名:xxx
密码:yyy
预期:服务器应该启动时没有任何问题,并且应该按照迁移sql文件中的说明创建表
实际:错误“原因:org.flywaydb.core.api.FlywayException:无法连接到数据库。配置URL,用户和密码!”。