According to this (and also this):
The Spring Environment has an API for this, but you would normally set a System property (spring.profiles.active) or an OS environment variable (SPRING_PROFILES_ACTIVE).
I am using version 2.7.3 of Spring Boot:
<dependency>
<!-- Import dependency management from Spring Boot -->
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>2.7.3</version>
<type>pom</type>
<scope>import</scope>
</dependency>
We have a src/main/resources/application.properties
file like this:
spring.datasource.driver-class-name=com.teradata.jdbc.TeraDriver
spring.jpa.hibernate.ddl-auto=none
spring.jpa.open-in-view=false
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.TeradataDialect
#---
spring.config.activate.on-profile=local
spring.datasource.username=
spring.datasource.url=jdbc:teradata://TDTEST/TMODE=ANSI,CHARSET=UTF8
spring.datasource.password=
#---
spring.config.activate.on-profile=prod
spring.datasource.username=
spring.datasource.url=
We built a fatjar using the maven shade plugin. But when we try to run it like this:
SPRING_PROFILES_ACTIVE=local java -ea -jar target/td-api-1.0-SNAPSHOT.jar
We get this message:
17:09:42.663 [main] INFO cdao.dpde.app.App - No active profile set, falling back to 1 default profile: "default"
Why? How can I fix this?