Custom postgres dialect isn't being picked up by spring
02:09 08 Oct 2025

I have a Spring project with a PostgreSQL database. I'm trying to add a custom dialect, but I've noticed that Spring is not loading it.

My dialect:

package org.company.configuration;

public class CustomPostgreSQLDialect extends PostgreSQLDialect {

    private static final Logger LOGGER = LoggerFactory.getLogger(CustomPostgreSQLDialect.class);

    public CustomPostgreSQLDialect() {
        super();
        LOGGER.warn("=== CustomPostgreSQLDialect INITIALIZED ===");
    }
}

and this is how I use it in the properties file:

spring:
  jpa:
    database: POSTGRESQL
    database-platform: org.company.configuration.CustomPostgreSQLDialect

at startup I don't see the log === CustomPostgreSQLDialect INITIALIZED ===, any idea what might be the issue? I've tried also to call it like this:

spring:
  jpa:
    properties:
      hibernate:
        dialect: org.company.configuration.CustomPostgreSQLDialect

This didn't work either. I tried recompiling and force cache cleaning via the command mvn clean compile -U, but still no luck!

java spring postgresql hibernate dialect