pom
Code: Select all
com.google.cloud
spring-cloud-gcp-dependencies
4.1.0
pom
import
...
org.postgresql
postgresql
com.google.cloud
spring-cloud-gcp-starter-sql-postgresql
Code: Select all
spring.jpa.hibernate.ddl-auto=update
spring.jpa.show-sql=true
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
spring.sql.init.mode=always
# GCP settings
gcp.project=project_id
gcp.project.region=project_region
gcp.postgres.instance=postgres_instance_id
gcp.postgres.database=database_name
# PostgreSQL connection
spring.cloud.gcp.project-id=${gcp.project}
spring.cloud.gcp.sql.instance-connection-name=${gcp.project}:${gcp.project.region}:${gcp.postgres.instance}
spring.cloud.gcp.sql.database-name=${gcp.postgres.database}
spring.datasource.url=jdbc:postgresql:///${gcp.postgres.database}?cloudSqlInstance=${gcp.project}:${gcp.project.region}:${gcp.postgres.instance}&socketFactory=com.google.cloud.sql.postgres.SocketFactory
spring.datasource.username=db_user
spring.datasource.password=db_pass
Code: Select all
2025-11-13T15:03:09.275+01:00 WARN 36220 --- [management] [ main] c.g.a.oauth2.DefaultCredentialsProvider : Your application has authenticated using end user credentials from Google Cloud SDK. We recommend that most server applications use service accounts instead. If your application continues to use end user credentials from Cloud SDK, you might receive a "quota exceeded" or "API not enabled" error. For more information about service accounts, see https://cloud.google.com/docs/authentication/.
2025-11-13T15:04:09.460+01:00 WARN 36220 --- [management] [ main] com.zaxxer.hikari.pool.PoolBase : HikariPool-1 - Pool is empty, failed to create/setup connection (3ddfd9fb-cb9a-4533-9dfe-3fd0ded3b497)
org.postgresql.util.PSQLException: The connection attempt failed.
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:385) ~[postgresql-42.7.8.jar:42.7.8]
at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:57) ~[postgresql-42.7.8.jar:42.7.8]
at org.postgresql.jdbc.PgConnection.(PgConnection.java:279) ~[postgresql-42.7.8.jar:42.7.8]
at org.postgresql.Driver.makeConnection(Driver.java:448) ~[postgresql-42.7.8.jar:42.7.8]
at org.postgresql.Driver.connect(Driver.java:298) ~[postgresql-42.7.8.jar:42.7.8]
at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:144) ~[HikariCP-6.3.3.jar:na]
at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:370) ~[HikariCP-6.3.3.jar:na]
at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:207) ~[HikariCP-6.3.3.jar:na]
at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:488) ~[HikariCP-6.3.3.jar:na]
at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:576) ~[HikariCP-6.3.3.jar:na]
at com.zaxxer.hikari.pool.HikariPool.(HikariPool.java:97) ~[HikariCP-6.3.3.jar:na]
at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:111) ~[HikariCP-6.3.3.jar:na]
...
Caused by: java.net.SocketException: Connection reset
Mobile version