Skip to main content

All Questions

Filter by
Sorted by
Tagged with
0 votes
1 answer
20 views

With Spring Boot and PropertySourcesPlaceholderConfigurer, how to resolve nested Properties?

I have a Spring Boot application. I am including multiple dependencies, which have different PropertySourcesPlaceholderConfigurer configured. One PropertySourcesPlaceholderConfigurer is reading ...
Harold L. Brown's user avatar
0 votes
1 answer
27 views

How to add a second PropertySourcesPlaceholderConfigurer without losing Spring Boot's default property resolution?

I am creating a Spring Boot application. I want to use Spring Boot's default mechanism for Spring's property resolution. I also need to embed an already existing custom Spring library. This library ...
Harold L. Brown's user avatar
0 votes
1 answer
31 views

In Spring Framework tests, how to make PropertySourcesPlaceholderConfigurer search System Properties first?

I am not using Spring Boot. I have a plain Spring Framework application. I have a Spring integration test written with SpringJUnitConfig. I am using PropertySourcesPlaceholderConfigurer. By default ...
Harold L. Brown's user avatar
0 votes
0 answers
52 views

Outsourcing .properties file based on context path in Spring Boot application deployed on Tomcat

I want to deploy multiple Spring Boot applications in one Tomcat server, each with different context paths, and I want to outsource the properties of each application. Specifically, I want the ...
Otabek Toshkanov's user avatar
0 votes
0 answers
27 views

Spring TestPropertySource params test use

I am implemented a bean class to store some parameters I would like to use in my software: /** * Parameters related to the H2 Database: * <ul> * <li>{@code uri}: The H2 address to the ...
Stefano Bossi's user avatar
0 votes
0 answers
25 views

Spring Property Management with List of object

Spring Version : 6.0.4 Java : 17 I am trying to load my properties file using spring based approach. This is my configuration class import java.util.List; import org.springframework.boot.context....
Developer's user avatar
  • 168
0 votes
0 answers
19 views

PropertySourcesPlaceholderConfigurer to load spring properties

I want to load spring properties using a specific format, not yaml nor properties. I wrote a PropertySourcesPlaceholderConfigurer, which is working perfectly in the UT but... When I start the Spring ...
Thibault Cuvillie's user avatar
0 votes
1 answer
207 views

spring cloud configuration vs local properties

I have a spring boot application with application.yaml, also I gonna switch a Spring Cloud Config Server on. The question is: which properties of these 2 above have a priority?
J.J. Beam's user avatar
  • 3,021
0 votes
1 answer
30 views

is there any other way to activate the profile and use the corrosponding application-{phase}.yml?

I have a spring application which has an application.yml and multiple application-{PHASE}.yml files. By default the application uses application.yml file. Now i require that it uses the application-...
Sunku Sravya's user avatar
2 votes
0 answers
60 views

Spring Framework: How and where use the "name" of the @PropertySource?

In Spring Framework, for the @PropertySource, according with its API or javadoc it has the name attribute Indicate the name of this property source. If omitted, the factory() will generate a name ...
Manuel Jordan's user avatar
0 votes
1 answer
912 views

Using Properties Class with Map within an spring native build

I try to build a native executable with GraalVM and Spring Boot 3.0. When I use configuration properties class including a HashMap, starting of these application fails. example project This class ...
Jonathan H's user avatar
0 votes
2 answers
653 views

Springboot database URL change during integration testing

I am doing integration testing, and have 2 databases to test my project against. Rather than creating 2 profiles, is there a quick and easy way where I create 2 integration test classes, and one to ...
Jason Chan's user avatar
2 votes
2 answers
1k views

Custom Spring properties files with profile-dependent loading

We are currently having one application.properties and one application-staging.properties, which is loaded based on the active Spring profile. However, it's very bloated and we like to split it into ...
Marian Klühspies's user avatar
1 vote
0 answers
353 views

Spring Boot Empty YAML array does not override property from source with lower precedence

In my application root directory i have an application.yml which contains: restresource: queryParams: and I have another yml on my classpath containing: restresource: path: myPath queryParams: ...
Claus Polanka's user avatar
5 votes
1 answer
7k views

How to set spring property to a null value from an environment variable

Spring properties can be bound from environment variables: https://docs.spring.io/spring-boot/docs/current/reference/html/features.html#features.external-config.typesafe-configuration-properties....
CamW's user avatar
  • 3,343
1 vote
1 answer
514 views

Merge multiple spring-boot property file in a single file

Is there any automation tool that allows merging multiple properties files in a single file, using spring boot profiles: from: application-dev.properties application-uat.properties application-prd....
fmp's user avatar
  • 29
2 votes
1 answer
3k views

spring boot 2.7.0 doesn't expose http.server.request metrics

I'm using Spring boot 2.7.0 and I'm trying to expose the http.server.request metrics so I can scrape it in Prometheus but it's not working. My application.yml properties look like this: management: ...
Iman Ahrari's user avatar
0 votes
1 answer
584 views

Properties with same name are getting over written in spring vault 3.0.0

I have configs in HashiCorp vault with same names in different path.But when i try to access it, i am always end up with the config1 prop1 value is getting overridden by config2 prop1 Vault Path path/...
Arunkumar KP's user avatar
0 votes
1 answer
228 views

How to write files in different directories based on different spring-profiles?

I generate a Zip File in my code and now i want to weite it in a directory /export in Production then I want to write it in /foo/bar I already got 2 Profiles (it & Production): application-it....
gabrielsterz's user avatar
0 votes
1 answer
182 views

yml list/array to java collection mapping is not working

I have the following config and java code to map the yml config however the rest, soap and javascript properties are not getting mapped. Tried the approach given here in accepted answer but no luck ...
Shiva's user avatar
  • 1,992
1 vote
0 answers
2k views

How to create property by condition in spring application.properties file

how can I create an if conditional in the spring applicaiton.properties file?. for example: restart.enabled=true project.name=(restart.enabled == true) ? "restartProjectName" : "...
Ahmad Al ALloush's user avatar
2 votes
2 answers
3k views

Load spring properties from library module properties file

I have a spring application where I have created a library module for accessing AWS Cognito that are going to be used by multiple applications. The service needs a couple of properties in order to ...
user3677636's user avatar
0 votes
0 answers
7k views

Spring Boot & WebClient - how to add additional headers using @ConditionalOnProperty to a specific WebClient instance?

I have a service that is holding an WebClient instance: @Service @Getter public class SomeApiWebClient { private final WebClient webClient; private final String someApiUrl; public ...
hc0re's user avatar
  • 1,986
0 votes
1 answer
486 views

How to read properties in its own when importing spring application jar into another application

I have two spring application let say application_a and application_b, My application_b is dependent on application_a. I created jar of first application using mvn package and added its jar to my ...
Afsar Ahamad's user avatar
  • 1,997
3 votes
2 answers
2k views

Spring boot override prod properties from additional location file

In my application I have these properties files: application.properties application-prod.properties Inside I have the same property spring.datasource.password=my-dev-password #for the default one ...
flywell's user avatar
  • 346
0 votes
1 answer
104 views

In Spring is it good practice to put custom properties into the default application.properties/yaml file?

I have a Spring Boot application. I want to add some custom properties. Is it good practice to put these properties into the default application.properties/application.yaml file? Or is it better to ...
Harold L. Brown's user avatar
0 votes
1 answer
540 views

Gradle String Boot multi-projects, expand application.properties

I'm using gradle to manage a multi-modules spring boot project. ->Root ---> module-1 --------->src/main/java --------->src/test/java/application.properties ---> module-2 --------->...
flywell's user avatar
  • 346
0 votes
1 answer
368 views

Is there a way to make IntelliJ autocomplete custom-named property files?

I have a custom-named property file inside a library, e.g. foo.properties which I then load in a configuration class, like so: @Configuration @PropertySource({"/foo.properties"}) public ...
Dimitrios K.'s user avatar
  • 1,018
2 votes
2 answers
172 views

How to make kotlin spring boot app fail if a combination of configuration is present in it's application.yaml

I am having a microservice which is spring cloud gateway implementation in kotlin. So as a part of a feature, i need to fail the start-up of this service if I found a specific combination of arguments ...
kuldeep singh bharati's user avatar
0 votes
1 answer
541 views

How can use ConfigDataEnvironmentPostProcessor and spring.profiles.group?

I'm using Spring Boot 2.4.2 and tried to use spring.profiles.group in my property files like: application.yaml spring: profiles: group: local: core application-core.yaml --- spring: ...
심시은's user avatar
  • 427
0 votes
1 answer
858 views

How to pass spring.datasource.data from docker as full path?

This is my docker-compose.yml file. version: '3' services: backend-service: build: ./backend-service volumes: - ./backend-service/database:/usr/lib/h2 ports: - 8080:8080 ...
Lorthiz's user avatar
  • 75
1 vote
0 answers
224 views

How to define spring profiles for different stages with many ANDs, ORs and NOTs?

I have three stages - stage-dev, stage-qa, stage-live, three datacenters - dc1, dc2, dc3 and three brands - brand1, brand2, brand3. I created three different property files - application-stage-dev.yml,...
John Watson's user avatar
3 votes
2 answers
2k views

Spring @Value doesn't work in nested configuration

I have a application.properties: app.cert.identity.subject.organizationalUnit=test app.cert.identity.subject.O=Pacific College app.cert.identity.subject.L=CanTho app.cert.identity.subject.ST=CanTho ...
SoT's user avatar
  • 1,203
1 vote
1 answer
3k views

Spring Boot, property of type Path read from application.yaml

I hope somebody will be able to help me with the following issue I find in Spring Boot version 2.3.5. I have simple test application (cannot share sources) where: I have a class annotated with @...
erani's user avatar
  • 21
0 votes
1 answer
1k views

Is there a clean way to extract nested properties from an application.properties using @ConfigurationProperties?

I was looking to move away from @Value annotation to using @ConfigurationProperties primarily because I ended up having too many properties so adding all of them in the target class seemed to clutter ...
vardantandon's user avatar
0 votes
1 answer
752 views

Spring PropertySourcesPlaceholderConfigurer beans: resolve property value at runtime

I am loading properties with multiple PropertySourcesPlaceholderConfigurer beans and setting placeholder prefix-es: @Bean public static PropertySourcesPlaceholderConfigurer fooPropertyConfigurer() { ...
lainatnavi's user avatar
  • 1,623
1 vote
4 answers
3k views

Spring Boot: Multiple WAR deployment in same tomcat different properties

So I have to deploy the same springboot app as multiple apps in the same tomcat server. eg /app1 /app2 /app3. They share most of the same configuration except for datasource configuration. I've been ...
Paul Snow's user avatar
0 votes
1 answer
775 views

Springboot - @ConfigurationProperties not populating the class fields

I know similar questions have been asked many times with different variations. I have tried to learn from them and from the available tutorials and try to get it working but I think I am missing ...
Pawan's user avatar
  • 1,233
1 vote
1 answer
206 views

How to get the effective Properties in Spring Boot application regardless of where it is defined?

suppose I define a property when starting my Spring Boot application from command line by passing -Dmy.property=314 to JVM, and also I define this property in the application.properties : my.property=...
mhrsalehi's user avatar
  • 1,354
2 votes
1 answer
1k views

Kotlin application.yml data class looking for beans

I have a Kotlin data class that I want to read properties from application.yml file. Here is my data class: @ConstructorBinding @ConfigurationProperties("meanwhile.in.hell.myapp") data ...
MeanwhileInHell's user avatar
5 votes
2 answers
3k views

Changing delimiter in @ConfigurationProperties for reading a List property

I have a list of values in one property in application.properties file: my-property=abc,def,ghi And I load it in my @ConfigurationProperties class: @Configuration @ConfigurationProperties public ...
mkczyk's user avatar
  • 2,700
1 vote
1 answer
875 views

Configure Spring boot for multiple DBMS and multiple profiles

I'm new to Spring Boot, and I don't know if what I want to do is possible, but I have the following problem to solve. 1 - I have an API with Spring Boot and I need to configure two DBMS (MySQL and ...
Mik3i4a5's user avatar
  • 179
0 votes
1 answer
71 views

SpringBoot complementary configuration file in system directory

I need some help to consume another .yml file that complement the original one in the application. Then I have a file filled by me(dev) however some configuration(as database infos) should be inserted ...
Hugo Vinícius's user avatar
0 votes
0 answers
244 views

location of Bootstrap.properties in Spring Cloud Config application

I was trying to develop Spring Cloud Config server with some properties. So on that site it was mentioned that replace the application.properties file into bootstrap.properties file. Code is given as ...
Ganesh Ghodake's user avatar
0 votes
1 answer
617 views

Spring Profile Use For Same Bean

Hi I am little bit confusign about using profiles in spring.My Scenario is I have a custom properties file.And It is values changes for each environment(dev,test,prod).I use same bean for each ...
Bilgehan's user avatar
  • 1,227
2 votes
0 answers
1k views

How to change Spring Boot's configuration properties programmatically when the app is running

I knew with Spring Cloud and some external configuration service (such Consul), when a property value changed, the Spring Cloud apps can retrieve the new value and refresh the Environment of the apps. ...
Tonny Tc's user avatar
  • 930
0 votes
2 answers
673 views

Spring Properties Defined in File not Resolved

When defining a property in application.properties such as deployment=dev spring.profiles.active=${deployment} Spring is unable to resolve the deployment property correctly. Main : The ...
aarbor's user avatar
  • 1,524
0 votes
0 answers
107 views

Access properties in runtime with dynamic name using spring

I have a properties file that looks like this server.se.host server.se.port server.us.host server.us.port and so on. It's a list of host/port used for different countries (Sweden and US in this ...
Andreas Wederbrand's user avatar
0 votes
1 answer
2k views

Spring properties: spring.config.additional-location not verriden property values

I'm using this command line in order to start my service locally: mvn -pl rep-digital-api clean compile spring-boot:run \ -Dspring-boot.run.arguments=--spring.config.additional-location=front-pre-...
Jordi's user avatar
  • 23.1k
1 vote
2 answers
269 views

Is it good or bad practice to inject particular beans depending on environment? [closed]

Use case: we want to apply e-mail address whitelisting in all environments, except LIVE (PROD) — here we want to send e-mails to any given address. Is it a good approach to annotate a bean that does ...
PresentProgrammer's user avatar