I want to set default profile=prod (when the project executes from the ci-cd on the server) and profile=local when I execute a project from intellij idea.
There is application.properties file:
spring.profiles.active=prod
#Database settings
spring.datasource.url=jdbc:mysql://localhost:3306/ddauth
...
There is application-local.properties file:
spring.datasource.url=jdbc:mysql://172.17.0.2:3306/ddauth
there is I set spring.profiles.active
parameter in IntellijIdea Run configuration:
I also try to execute my jar file with a such parameter:
java -jar app.jar -Dspring.profiles.active=local
In any case, the project is executing in the prod
mode. I receive following message during execution:
2023-08-01 23:02:52 [INFO] | AuthRunner:640 The following 1 profile is active: "prod"
I read many different tutorials and haven't any ideas how it has to work. I know I can set this profile parameter also in the bootJar
task, but I don't want to go through this way. I want implement this simple solution and figured out why it isn't work.