Questions tagged [spring-environment]

28 questions
1
vote
0 answers

Property sources order in PropertySourcesPropertyResolver

This is a part of my config class: @Configuration @PropertySource("classpath:properties.properties") public class DataBaseConfig { @Resource private Environment env; @Bean public DataSource dataSource() { …
funny-funny
  • 41
  • 1
  • 6
1
vote
2 answers

Spring Environment - multiple?

I am confused about how Spring Environment works. I thought it is basically a singleton bean in the ApplicationContext and anytime I load PropertySources into my AppCtx, they combine into this single Environment automatically. However, I am seeing…
Jason
  • 2,006
  • 3
  • 21
  • 36
1
vote
2 answers

Get Spring Environment as Properties

I wonder if there is a way to extract properties from Spring Environment (e.g. obtained from ApplicationContext) in the form of Properties instance? Or, at least, is there a way to enumerate the properties in Spring Environment, or get them all as a…
Vlad.Z
  • 160
  • 10
1
vote
1 answer

Spring Best approach for multiple environments

I have the following: System A - Authorization (REST API) System B - Needs to check for auth System C - Needs to check for auth System D - Needs to check for auth And I have many environment: Development Homolog Production Each one will have…
Marco Noronha
  • 115
  • 1
  • 9
  • 31
0
votes
1 answer

Unable to load properties from multiple yml file in a boot app

I have a microservice where I want to have few properties which are environment dependent so I'm using application.yml, and application-dev.yml, application-int.yml etc..... upon startup I pass spring.profiles.active=myprofile and relevant…
ThrowableException
  • 1,168
  • 1
  • 8
  • 29
0
votes
1 answer

Why doesn't Environment in bean see properties from source in integration context?

In my Spring Integration webapp configuration I've added a property placeholder:
watery
  • 5,026
  • 9
  • 52
  • 92
0
votes
1 answer

Spring Environment: order of systemProperties and systemEnvironment

Is it possible to control order of resolution from Spring Environment from underlying PropertySources? For example. I have OS environment variable ENV key=os and run java with System environment variable java -Dkey=system What the output of…
qwazer
  • 7,174
  • 7
  • 44
  • 69
0
votes
1 answer

Spring 5 getting lists of objects from Environment

using latest Spring 5 on Java 9.... With the following YAML: flow: - name: cats url: http://dogs.com - name: dogs url: http://cats.com With Environment the nested property values can be pulled as usual (env.getProperty("flow[0].name")…
Matthew Campbell
  • 1,864
  • 3
  • 24
  • 51
0
votes
1 answer

Populate Map with entire .property file from Environment Spring

I have this myProperties.properties files with the following content: enum1 = a enum2 = b enum3 = c enum4 = d and so on... My problem is how can I populate or inject all property values in a Map - enum1..4 as the key and 1..d as the…
0
votes
2 answers

Add applicationConfig PropertySource to new Environments

I'm currently working on migrating an existing application to Spring Boot 1.2 (uses Mule 3; isn't compatible with Spring 4.2). This application contains a library-provided (that I can't modify) servlet that does the Mule bootstrap process by…
gnzlrm
  • 190
  • 1
  • 12
0
votes
1 answer

Use spring to load a text file where its location is defined as spring el

In an spring base project, we want to load a file from classpath the file location must be evaluated from an spring el expression. This feature is currently in spring which loads property files, the location can be any Spring EL.
Alireza Fattahi
  • 42,517
  • 14
  • 123
  • 173
0
votes
1 answer

Spring 3.1 basic usage of Envirionment and PropertySource

I want to inject property values into the Spring context when it is started. I am trying to do this using the new Environment and PropertySource features of Spring 3.1. In the class in which loads the Spring context, I define my own PropertySource…
user1052610
  • 4,440
  • 13
  • 50
  • 101
0
votes
1 answer

Can PropertiesPlaceholderConfigurer subclass detect active Spring profile?

We have a specific format for our config files, where instead of having multiple files - ie, dev.properties, uat.properties, prod.properties - we instead have all the values in one file, but separated by prefixes for each environment. For…
trafalmadorian
  • 1,660
  • 1
  • 15
  • 21
1
2