Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to define spring profile on AWS

I have deployed my war file on AWS's Elastic Beanstalk as a java app.

I want to specify on AWS : spring.profiles.active like I do when I execute:

java -jar -Dspring.profiles.active=prod target/gaming-boost-0.0.1-SNAPSHOT.war

I can only configure "Environment Property" on "Configuration"

like image 330
Z3nk Avatar asked Jan 12 '17 14:01

Z3nk


People also ask

Where are spring profiles stored?

Profiles work in conjunction with Spring Boot properties files. By default, Spring Boot parses a file called application. properties – located in the src/main/resources directory – to identify configuration information.

What is Spring default profile?

The default profile is always active. Spring Boot loads all properties in application. yml into the default profile. We could rename the configuration file to application-default. yml and it would work the same.


2 Answers

Set below environment variable in ElasticBeanStalk

SPRING_PROFILES_ACTIVE=prod
like image 117
Vaibhav Avatar answered Oct 10 '22 14:10

Vaibhav


Take a look at https://stackoverflow.com/a/39021794/2135973

The casing is different when set as an Environment Variable versus the command line property. Try setting SPRING_PROFILES_ACTIVE in your EB Configuration.

like image 1
Adam Erstelle Avatar answered Oct 10 '22 12:10

Adam Erstelle