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
0
votes
1 answer

Can I use @Profile Tags on Components without creating an @Configuration class in Spring Boot or a Web.xml

I've managed to avoid developing any xml files so far for my Spring Boot Maven project (apart from the pom) with them all being generated on compile and I was hoping to keep this way by defining my profiles within the run commands as specified…
Scott Allen
  • 513
  • 2
  • 13
0
votes
1 answer

Spring boot, use profiles to load files

I have used spring-boot profiles to change property values for different environments, now I want to use the same approach to load different resource files, ie example I have dev_queries and prod_queries.xml with sql queries. How can I make…
Juan Rada
  • 3,513
  • 1
  • 26
  • 26
0
votes
1 answer

get actual spring profile inside WebApplicationInitializer

I have the following entry in web.xml: spring.profiles.default test and following WebInitializer: public class H2Starter implements…
gstackoverflow
  • 36,709
  • 117
  • 359
  • 710
0
votes
2 answers

How to swich on contextLoadListener depends on spring profile

I need to execute code before application will be started. I have wrote the following listener(registered in web.xml): Profile("test") public class H2Starter extends ContextLoaderListener { @Override public void…
gstackoverflow
  • 36,709
  • 117
  • 359
  • 710
0
votes
1 answer

How to use a spring profile bean in another bean with default profile?

I have a bean under the "dev" profile: @Bean(name="internalDL") public Map> internalDistributionLists() { Map> distributionLists = new HashMap>(); …
alokraop
  • 853
  • 1
  • 11
  • 29
0
votes
1 answer

Spring error - Using Spring profiles : Exception starting filter applicationFilterChain

I started with a working Spring configured Web application and have been adding a Spring profile to the beans tag in the Spring context configuration files :
NottmTony
  • 447
  • 1
  • 6
  • 28
0
votes
1 answer

Loading profile specific properties when there are multiple active profiles

According to http://docs.spring.io/spring-boot/docs/current/reference/html/howto-properties-and-configuration.html I can load different application.properties files using application-${profile}.properties and setting the active profile. That is…
peekay
  • 1,259
  • 2
  • 25
  • 49
0
votes
1 answer

Spring MVC Rest environment profiles

I want to be able to use different application.properties in my MVC REST app. I've created application-.properties for each of my enironments. I only managed to get this to work by setting -Dmyapp.env= then adding …
Daniel Cosio
  • 177
  • 1
  • 2
  • 16
0
votes
2 answers

How To Disable a Field From Response based on Environment

Context: A Spring REST Web Service where is sends a response with POJO (example: Output.java) Now, Output.java contains 2 fields - @JsonProperty("One") private String one; @JsonProperty("Two") private String two; So in the response I get both these…
Melvins
  • 320
  • 2
  • 9
0
votes
2 answers

Spring default profile properties

I have next issue. I'm using following configuration: classpath:config/main.properties
Mikhail Linkov
  • 63
  • 2
  • 10
0
votes
1 answer

loading Spring profiles from database

One may dynamically load Spring profiles by implementing ApplicationContextInitializer and adding Spring profiles to the environment. The problem is that in one of projects I am helping in they are using properties stored in database. How to load…
goroncy
  • 2,053
  • 1
  • 19
  • 16
0
votes
0 answers

How to map spring profile with custom profile resource

As per my understanding, the @Profile annotation looks for the value of spring.profiles.active system property. Can we map @Profile with the custom profile resource so that instead of using the value of spring.profiles.active, it uses the value of…
Tarun Gupta
  • 107
  • 3
  • 16
0
votes
2 answers

how to set JVM Property in tomcat 8

Can you please advice how to set JVM Property in tomcat 8 ? I need to set spring.profiles.active to enable profile . I tried to find out option to set JVM profile in tomcat admin page but this doesn't seems to be an option ... thanks in advance ...
Shri S Softwares
  • 1,529
  • 2
  • 12
  • 16
0
votes
2 answers

Error creating Spring Profiles

I am getting the error: cvc-complex-type.2.4.a: Invalid content was found starting with element 'sec:http'. One of '{"http://www.springframework.org/schema/beans":beans}' is expected. I am simply creating a local spring profile with a…
0
votes
1 answer

Default Spring bean when profile is not present

I'm using Spring MVC controllers, and I'd like to make some extra request-mapped methods available during development. I can do this using Spring profiles: @Controller @Profile("!dev") public class DefaultController…
whistling_marmot
  • 3,561
  • 3
  • 25
  • 39