Questions tagged [configurationproperties]
89 questions
1
vote
1 answer
How to set propertysource to config file fetched from cloud config server in java spring?
I'm using ConfigurationProperties annotation to map some values from application.yml to java class. Everything works fine when using it with localhost config file, but when I'm fetching configurations from cloud config, those values cannot be found.…

Paweł Sosnowski
- 173
- 3
- 12
1
vote
2 answers
Spring ConfigurationProperties validation of a Double value
I have a property value that should range between 0 and 1.
I like Spring's ConfigurationProperties to validate the property value.
So in my ConfigProperties class I added the @Validated annotation and wrote this:
@Min(0)
@Max(1)
Double…

riorio
- 6,500
- 7
- 47
- 100
1
vote
1 answer
Injecting properties from application.yml to a map
I have my application.yml with different properties as shown below.
lists:
exampleList: [1,2,3]
exampleString: abcde
another:
example1: exam1
example2: exam2
And I'm binding these properties to a Spring…

JKtx5
- 31
- 1
- 1
- 6
0
votes
1 answer
consuming a map from configmap to springboot application
I have added a map in my values.yaml file like below
defaultview:
journey:
ce5f164c-ae0f-11e7-9220-c7137b83fb6a: 45
abc: -1
pqr: 30
I read this property in configmap like below
defaultview.journey: {{ .Values.defaultview.journey…

Prashant Raghav
- 319
- 2
- 6
- 15
0
votes
0 answers
How to test ConfigurtionProperties for immutable records?
I have records taking values from configuration properties:
@ConfigurationProperties(prefix = "car")
public record CarConfig(Type type) {
public record Type() {}
}
I cannot put there @Configuration annotation cause as it is a record, it is…

Koin Arab
- 1,045
- 3
- 19
- 35
0
votes
1 answer
@ConfigurationProperties without default values in spring boot 3 using Kotlin
I try to implement my first spring boot application using Kotlin.
spring-boot version is 3.1.0
I have a configuration class like this(based on https://stackoverflow.com/a/74445643/2674303):
@Configuration
@ConfigurationProperties(prefix =…

gstackoverflow
- 36,709
- 117
- 359
- 710
0
votes
0 answers
Using ConfigurationProperties / Constructor binding for immutable kotlin data class with custom spring context
I'm building a custom Spring context for my test in Spring Boot 2.7 (feel free to provide also a solution for newer versions). I'm not able to specify exact list of classes / auto-configuration needed for using ConfigurationProperties (kotlin,…

Robert Gonciarz
- 363
- 2
- 8
- 15
0
votes
1 answer
Manipulate and validate ConfigurationProperties value in Spring Boot
I have a configuration property:
@ConfigurationProperties(prefix = "x.retention")
@Slf4j
@ConstructorBinding
@AllNonNullByDefault
@Validated
public class RetentionProperties {
private String isoPeriod;
}
isoPeriod is going to be a period in…

Diana
- 935
- 10
- 31
0
votes
1 answer
@ConfigurationProperties to fill Map
I used Map data to make dynamic
@Configuration
@ConfigurationProperties("test")
@Data
public class Config {
private Map data;
}
How can I get data as expected?
example yaml
test:
a: a
b: b
c:
- name:…
0
votes
1 answer
How to write Spring unit tests for classes annotated with @ConfigurationProperties?
I have a class with configuration properties and I would like to write an unit test in Spring (the application is based on Spring Boot), but I don' want to use @SpringBootTest, because the whole application context is loaded for too long.
POM…

Tomasz Kamiński
- 3
- 4
0
votes
0 answers
spring @ConfigurationProperties dynamic prefixes
I have 2 organizations, a and b, for which, I have properties as follows. Additionally, I have another property which lists the organizations I…

Deven
- 55
- 1
- 7
0
votes
1 answer
Cannot bind Map to Object in Spring Configuration Properties from YAML file
I have the following configuration in my Spring boot's application.yml file:
project:
country-properties:
france:
capital: paris
population: 60
And I have the the properties class : CountryProperties…

John Dist
- 77
- 10
0
votes
0 answers
Use configuration properties in Spring expression language
I have a class with configuration properties:
@Data
@ConfigurationProperties("message-starter")
public class JobProperties {
public Duration kafkaSendingPeriod;
public Duration rabbitSendingPeriod;
}
And class that aggregates this…

Kirill Zhurbin
- 51
- 3
0
votes
0 answers
Using @ConfigurationProperties to override an application.yml property isn't working, isn't it straightforward?
I thought / hoped that overriding property values using ConfigurationProperties would be as easy as reading them, but it isn't, so I feel like I'm missing something trivial as right now I have a JavaFX application with different screens in which I…

JeroenV
- 53
- 2
- 10
0
votes
1 answer
@ConstructorBinding data class Properties with numbers as names
i'm adding property validation to an existing big project. It has hundrets of webservices and there are some that have simple numbers as names.
Now im trying to write a data class using @Validated, @ConstructorBinding and…

Jebb Süffel
- 1
- 1