Search code examples
springspring-data-jpadefault

Spring data default value of spring.data.jpa.repositories.bootstrap-mode


After upgrading to spring 2.3.x my application didn't start anymore. After a lot of debugging I was able to determine the problem. The default value of the property spring.data.jpa.repositories.bootstrap-mode is now deferred. My first question is why would someone make the default value of a property anything else than default and my second question is if I somehow can change the default value of that property without explicitly setting it in my application.yml.

Also found this piece in spring-configuration-metadata.json:

...
{
  "name": "spring.data.jpa.repositories.bootstrap-mode",
  "type": "org.springframework.data.repository.config.BootstrapMode",
  "description": "Bootstrap mode for JPA repositories.",
  "defaultValue": "deferred"
},
...

Solution

  • change the --default-- value of that property without explicitly setting it in my application.yml

    Well this is the exact purpose of that file - to override default settings that will become "new defaults" and can bu futher on customized via profile, envirnonment variables, cli arguments etc.

    why would someone make the default value of a property anything else than default

    I can imagine that you have some sort of fail-fast logic around peristence layer, and in such case you would like it to be invoked right away - during app bootstrap -- , not after deployment when someone actually will use your application. Having it defferred is usually fine, and fits most of the usecases.