Search code examples
spring-bootapplication.properties

Multi-document file in Spring Boot 3


I wanted to create a multi-document application.properties in Spring Boot REST API. I wanted to create two profiles (prod and dev) with spring.data.rest.limit-param-name property with value 5 for prod and 100 for dev. Actually, IntelliJ informes me about duplicate property key, even though I try to follow this guidance:

Spring Boot docs

My code looks like that:

spring.profiles.active=prod,dev
spring.data.rest.limit-param-name=5
#---
spring.config.activate.on-profile=dev
spring.data.rest.limit-param-name=100

Solution

  • Answer to my own question:

    It appeared that I did not provided accurate lines, so the file did not want to run. Here is the answer:

    spring.data.rest.limit-param-name=5
    spring.profiles.active=dev
    #---
    spring.config.activate.on-profile=dev
    spring.data.rest.limit-param-name=100