0

I upgraded spring-boot-starter-parent from 2.3.1 till 2.5.5 and now 'spring.profiles.active' property can't be injected from pom to application.properties file. Instead of profile value I get in console "The following profiles are active @spring.active.profile@"

My .pom file

<profiles>
    <profile>
        <id>dev</id>
        <activation>
            <activeByDefault>true</activeByDefault>
        </activation>
        <properties>
            <spring.profiles.active>dev</spring.profiles.active>
        </properties>
    </profile>
    <profile>
        <id>prod</id>
        <properties>
            <spring.profiles.active>prod</spring.profiles.active>
        </properties>
    </profile>
</profiles>

application.properties

spring.profile.active=@spring.profile.active@
Pasha Xa
  • 1
  • 2
  • 1
    Why do you need Maven profiles? In Spring Boot you can create different application.properties files. First `application.properties` which will be used if no spring profile is defined. `application-dev.properties` if you use `--spring.profiles.active=dev` etc. So usually it's a bad idea to use maven profiles...better use spring profiles...I strongly recommend to read about spring profiles: https://docs.spring.io/spring-boot/docs/current/reference/html/features.html#features.profiles – khmarbaise Sep 26 '21 at 08:27
  • Please provide the entire pom.xml. Where are you setting up the filtering of the application.properties file? Ideally we'd need a runnable example - create a smaller project in Github or something. If you can reproduce the same bug in that, we might be able to help you. – ac_ Oct 04 '21 at 09:22

0 Answers0