Introduction

In a few posts I already mentioned how comfortable it is to use Spring Boot, because it offers a really nice plugin system, when you include other Spring projects like Spring Data. It will automatically configure the dataSources from the properties you added. Also the naming strategy.

The problem

In our project I had to use two entityManagers connecting to different databases and it took me some time to get it right. Mostly, because I could not find the naming strategy, which ‘Spring Boot’ used automatically.

You would think, that the naming strategy should be in the Spring Data JPA packages, but you would be wrong :-)

Default naming strategy

The default naming strategy can be found in the Spring Boot packages, more exactly in the following:

org.springframework.boot.orm.jpa.hibernate

The name of the naming strategy is SpringNamingStrategy and the key-value-pair for the properties file is:

spring.jpa.hibernate.naming-strategy=org.springframework.boot.orm.jpa.hibernate.SpringNamingStrategy