Questions tagged [spring-profiles]

Spring Profiles provide a way to segregate parts of an application configuration and make it only available in certain environments.

Spring Profiles provide a way to segregate parts of an application configuration and make it only available in certain environments.

http://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-profiles.html

349 questions
8
votes
3 answers

Spring not overriding active profile from command line

Here is my application.yml file: spring: freemarker: template-loader-path: classpath:/templates datasource: url: jdbc:postgresql://localhost:5432/myapp username: postgres password: password driver-class-name:…
conquester
  • 1,082
  • 2
  • 21
  • 44
7
votes
2 answers

How to set Flyway migration file location using Spring profiles

I have two Spring profiles dev and test configured for development and test environment. And in each environment I am using different databases viz h2 in dev and postgresql in testing. Following are my properties files for each profile where…
7
votes
2 answers

How to change default spring profil ("cloud") in cloud foundry

I want to launch my spring-boot application after a cf push with a custom profile named my_profile, but the app is always launched with the default one cloud profile. How can I specify the exact profile to load? I already tried to add the…
marherbi
  • 351
  • 4
  • 15
7
votes
2 answers

Profile Inheritage In spring boot

Is it possible to have a profile in spring boot and also another profile that inherits most of the parent values and beans? For example I have two profiles staging and staging-task. I want staging-task to inherit the database configuration of the…
gkatzioura
  • 2,655
  • 2
  • 26
  • 39
7
votes
4 answers

How to set active profile programmatically for any environment?

I want to set active profile host dependent for any envrionment and cannot find an environment independent hook. Following factory will set the active profile before application context will…
7
votes
2 answers

Maven and spring-boot: how to specify profile(s) on spring-boot:repackage

With spring-boot, I know that I can have profiles and use different configuration files depending on the active profiles. For instance the command: "mvn spring-boot:run -Drun.profiles=default,production" will run my spring-boot application using…
DanielC
  • 357
  • 1
  • 4
  • 10
7
votes
1 answer

Can the Spring active profiles be set through a property file?

I want to be able to read the active profiles from a property file so that different environments (dev,prod etc) can be configured with different profiles in a Spring MVC based web application. I know that the active profiles can be set through JVM…
Navin Viswanath
  • 894
  • 2
  • 13
  • 22
7
votes
1 answer

Gradle build spring boot app as war with active profile

I would like to package my spring boot application as war for a specific profile. That can be done with setting spring.profiles.active=profile name in application.properties file. Is it possible to set it as a parameter when building war eg. gradle…
stamis
  • 2,545
  • 2
  • 15
  • 9
6
votes
1 answer

How to set a Spring profile to a package?

I want to set a profile name to a whole package and I don't know how. If where is no easy way then I have to mark every class in the package and sub packages with @Profile annotation. tag does not support attribute like…
JSPDeveloper01
  • 770
  • 2
  • 10
  • 25
5
votes
4 answers

spring boot not loading default profile while using spring.profile.default in application.properties

FYI : I swear there is no activating profile configuration such as -D or run configuration Goal When application is booted up without any activating profile, the dev profile is activated as a default. Problem I've set spring.profile.default = dev ,…
Minwoo Kang
  • 75
  • 1
  • 1
  • 7
5
votes
2 answers

How to access application-{profile}.properties file based on active profile

I have a requirement of accessing application.properties file outside the project location. I am able to achieve the same using following : @Component @PropertySources({ @PropertySource(value =…
5
votes
1 answer

Spring YAML profile configuration

I'm not sure if I well understand how Spring profiles works with yaml and properties files. I was trying to misc those two types of configuration (the two file do not share any configuration) but i'm having problems when reading profiles from yaml…
5
votes
1 answer

exclusive Spring profiled beans and DependsOn annotation

The code that works for me: part of configuration of the database looks like this: @Profile("!dbClean") @Bean(initMethod = "migrate") public Flyway flywayNotADestroyer() { Flyway flyway = new Flyway(); flyway.setDataSource(dataSource()); …
goroncy
  • 2,053
  • 1
  • 19
  • 16
4
votes
0 answers

Kafka throws InvalidReceiveException when springboot application is configured with spring.profiles.active

I am new to kafka in springboot. While working on a spring boot application, I encountered the following error in Kafka org.apache.kafka.common.network.InvalidReceiveException: Invalid receive (size = 369296129 larger than 104857600) And the…
4
votes
2 answers

How to call different implementations of a bean based on profile in spring

I need to add multiple implementations of an interface and one of them should be picked up based on profile. For e.g. interface Test{ public void test(); } @Service @Profile("local") class Service1 implements Test{ public void test(){ …
user1298426
  • 3,467
  • 15
  • 50
  • 96
1 2
3
23 24