Setting PostgreSQL max_connections value in properties gives PSQLException
cfecherolle opened this issue · comments
Hi,
I'm using the library for my tests with a PostgreSQL database and the Zonky provider.
I have tried setting the PostgreSQL max_connections
property in my Spring Boot configuration, like this:
zonky:
test:
database:
postgres:
client:
properties:
max_connections: 300
When launching a test class, the Spring Boot context fails to load and gives me the following error:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory; nested exception is io.zonky.test.db.shaded.com.google.common.util.concurrent.UncheckedExecutionException: io.zonky.test.db.provider.ProviderException: Unexpected error when prefetching a database; nested exception is java.lang.RuntimeException: org.postgresql.util.PSQLException: Unsupported property name: max_connections
After diving a bit deeper in the source code, I found that the enum org.postgresql.PGProperty
is being used by the lib as a reference to set the properties of the PostgreSQL database. Problem is: this enum does not contain any "max connections" value.
I'm unsure how this configuration is supposed to be working, could someone help me?
Thank you.
Ok, my bad, I used client.properties
when it should have been server.properties
😅
Problem solved! Feel free to delete this issue.
Ok, glad to hear it works as expected 🙂