172 questions
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 ...
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 ...
0
votes
0
answers
74
views
@SpringBootTest: @ActiveProfiles doesn't work when put on @Nested inner class
I have a spring boot app.
project deps (plugins section):
id 'org.springframework.boot' version '2.6.1'
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
And I want to test on of my ...
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 ...
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 ...
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 ...
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....
0
votes
0
answers
238
views
Spring Boot 3.2.1 multiple .properties files per profile
I want to have a project which allows me to have multiple profiles and also multiple configurations per profile. I want to have my general application.properties on top, and then per profile a ...
2
votes
1
answer
701
views
@ConfigurationProperties in spring-boot:3.2.X does not working
I'm testing SpringBoot 3.2.0 in a new project (created from spring's scaffold) and when I configure a @ConfigurationProperties(prefix = "some.path.to.be.parsed") class (and @...
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 ...
1
vote
1
answer
744
views
Spring Boot converter not working for configuration properties
I am attempting to provide a Converter to convert a r,g,b tuple in application.yml into a Color object. The property resolution fails with: "org.springframework.core.convert....
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?
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-...
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 ...
0
votes
1
answer
65
views
test module cannot load its application.yml file
I have a separate module for functional testing of the application module. Its structure is as below
└───functional-test
├───pom.xml
└───src
├───test
├───java
| ...
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 ...
0
votes
1
answer
358
views
Spring boot - replacing properties in Hadoop core-site.xml config file
I have Spring boot Spark based application with following Hadoop core-site.xml config file where I would like to replace the properties ${my.access.point.name} and ${my.access.point.arn} at runtime.
&...
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 ...
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 ...
0
votes
1
answer
1k
views
Spring Boot Custom starter - Set properties
I have a custom Spring Boot starter.
@Configuration
public class MyAutoConfiguration {
private static final Logger logger = LoggerFactory.getLogger(MyAutoConfiguration.class);
@Bean
...
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:
...
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....
2
votes
1
answer
4k
views
Spring Boot Application Properties Variable Conversion/Matching when retrieved from ENV variable?
In my application.yaml properties file I have a variable defined as below -
service-account:
# secret: //commented in the yaml file, to indicate that it's used in app but read from ENV variable.
...
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....
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:
...
2
votes
1
answer
2k
views
Spring Boot + Docker Compose: How to override 'Map<String, List<String>>' environment variable from yaml properties
I am using yaml properties file for the sping boot configuration.
My structure of application.yml is following:
information:
server: ${SERVER_INFO:devserver}
config:
"[http://www.myshop....
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/...
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....
15
votes
1
answer
47k
views
What is diff between spring.profiles.active vs spring.config.activate.on-profile?
What is exact difference between spring.profiles.active and spring.config.activate.on-profile?
"WARN","msg":"Property 'spring.profiles' imported from location 'class path ...
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
...
0
votes
1
answer
437
views
Spring integration 4 to 5 migration - Issue with integrationGlobalProperties
We have been using Spring integration 4.3.1.RELEASE along with Spring core 4.3.2.RELEASE. Recently we had to upgrade the stack with 5.5.11 and 5.3.19 versions resp. This is not a Spring boot app.
...
0
votes
1
answer
1k
views
Understanding the spring profile
I have basic idea how spring profile works. But here in this file this - i am not able to get it. And current Application.yml file mentioning the three profile which one will get active and when that ...
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" : "...
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 ...
2
votes
1
answer
1k
views
Ignore specific property when running a Spring Boot test
My Spring Boot application contains the following property in src/main/resources/application.yml:
spring:
security:
oauth2:
resourceserver:
jwt:
issuer-uri: ${...
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 ...
2
votes
1
answer
849
views
How do I resolve spring configuration property without @ConfigurationProperties?
I'm using Java 8 and Spring Boot. And I'm trying to solve the warning "Cannot resolve configuration property" from IDEA:
(application.properties)
But for this param I don't have any @...
0
votes
2
answers
3k
views
Loading Spring-boot properties to POJO
I have properties like this:
credentials:
userid: <userid>
password: <password>
I have a POJO:
@Setter
public class Credentials {
private String userid;
private String ...
4
votes
0
answers
469
views
Spring Polymorphic Properties: CustomBindHandler works but not for Lists
I have a bunch of entities, I would like to load from the application.yaml file. The structure seems rather complex but it is as it is and that includes polymorphism with some classes:
This is the ...
0
votes
0
answers
277
views
Jndi ldap log4j vulneraility
As the entire world know that the log4j vulnerability involves jndi ldap lookup attack. There cpuld be many other libraries using jndi ldap lookup for property resolutions. What is the possibilty ...
-1
votes
1
answer
164
views
Import component from add-on directory
I am using Vaadin version 21.0.7 with Spring Boot and i want to import Paginator add-on.
I have added addon's groupId in applicaton.properties as follows: vaadin.whitelisted-packages=com.test.demo,com....
1
vote
1
answer
1k
views
Profile specific logging in Spring Boot
We have a spring boot application using log4j2.
We want to use different log levels for different profiles. After lot of struggles, I found out that this is not possible with log4j2 but it is possible ...
0
votes
0
answers
586
views
Kubernetes Configmap data format
I'm writing a K8s configmap for my Spring Boot application.
This is my application.yaml file:
app:
config:
paths:
- id: a
uri: http://localhost:8080
args:
- ...
0
votes
0
answers
167
views
Not able to find the <custom>.properties file from the jar using spring boot gradle
Not able to find the sensitive .properties file path, when I run the jar, but from IDE it is executing, using Gradle.
sensitive. properties is in the resources folder
public void getConfigValue(String ...
0
votes
1
answer
485
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 ...
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
...
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 ...
0
votes
1
answer
2k
views
Spring cloud config server for multiple stage
I'm working with spring cloud config server, and my need is to create a configuration file for each stage prod test and dev, I already created 4 yml file application.yml for the default profile, ...
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
--------->...
0
votes
1
answer
2k
views
Spring Boot Property file precedence
In my Spring Boot program I'm getting a failure due to a bad property value on load. In particular, it uses the DB2 hibernate dialect but it's not defined in the property file I thought I was using.
...