Questions tagged [configurationproperties]

89 questions
2
votes
0 answers

How to validate configuration properties only on certain condition?

I have the following configuration properties class: @Getter @Setter @ConfigurationProperties(prefix = "myprops") public class MyProps { private boolean enabled = true; @NotEmpty private String hostname; @NotNull private Integer…
jnnk.smyer
  • 53
  • 4
2
votes
2 answers

Sping-boot configuration-properties and service layer injection

I'm new to spring dependency-injection and am reaching out to learn about best practices. I would like to know if its a good design philosophy to inject classes annotated with @ConfigurationProperties into service layer classes (annotated with…
2
votes
1 answer

Why does @ConfigurationProperties need getters?

I realized a strange behavior in SpringBoot. In a yml file I have the following configuration: main: record-id: start-position: 1 value: 1 enabled: true record-name: start-position: 2 value: main enabled: true …
victorio
  • 6,224
  • 24
  • 77
  • 113
2
votes
1 answer

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 class MyAppProperties(val serverId: String, val locationId:…
1
vote
0 answers

Spring Boot configuration properties: Resolve properties that are a map

given the following sample class @ConfigurationProperties("myapp") public class MyProps { MyProps(Map propertymap) { System.out.println("propertymap = " + propertymap); } } and following application.yml myapp: …
markus_
  • 480
  • 3
  • 12
1
vote
1 answer

Third-party @ConfigurationProperties not being populated by spring-boot

I have a bean wiring up a 3rd-party class as a @ConfigurationProperties bean, but Spring never populates the values. the code looks something like: The bean binding: @Bean @ConfigurationProperties(prefix = "aws") …
toadzky
  • 3,806
  • 1
  • 15
  • 26
1
vote
1 answer

How to inject generic @ConfigurationProperties in Spring

I have generic ClientProperties class used by multiple rest clients to bind the client specific properties with implementation. @Data @Validated public class ClientProperties { @NotBlank private String url; @NotNull private…
Tuomas Toivonen
  • 21,690
  • 47
  • 129
  • 225
1
vote
1 answer

@ConfigurationProperties is not working in Spring Boot 3.0.1

I faced the issue after upgrade SpringBoot from 2.x to 3.0.1 In kotlin, @ConfigurationProperties deosn't generate 'peroperteis' field in some conditions. 1. Code: 'var' with default value @ConfigurationProperties(prefix = "cnr.app") data class…
unD3R
  • 34
  • 5
1
vote
0 answers

Using @ConfigurationProperties for partitional different prefix

I have my application.yaml, f.e: bookshop: properties: books: maxSize: title: 60 description: 800 price: commonDiscount: 10 sale: true Now I create 'getter-class' for getting this values with @Value…
1
vote
1 answer

Fail during startup if unknown properties are defined?

I am using spring boot configuration properties with an optional property: @ConfigurationProperties("my.properties") public class MyProperties { List optional = new ArrayList(); // optional property // getters/setters } I want my…
jnnk.smyer
  • 53
  • 4
1
vote
1 answer

Using @ConstructorBinding with @ConditionalOnProperty in Springboot

I'm using @ConstructorBinding with @ConfigurationProperties like this @ConstructorBinding @ConditionalOnProperty(name = "nexus.orchestration.cloud.model", havingValue = "true", matchIfMissing = false) @ConfigurationProperties(value =…
1
vote
1 answer

spring-configuration-metadata.json is not generated properly for multi-module project

I've created multi-module project: (pom) root (jar) libModule (jar) appModule, has libModule in dependencies appModule pom has dependency: org.springframework.boot
1
vote
0 answers

Change build time configuration in Quarkus

I am running a Quarkus Rest Easy based Java application which is pulling data from an external application to load its cache. However I have recently started getting the exception below and the application cannot seem to be able to load the…
1
vote
0 answers

@ConfigurationProperties with XML-based configuration

How can I re-write the following annotation-based configured class: @ConfigurationProperties(prefix = "app") class MyConfig { private String username; private String password; } To the XML-based configured class? Specifically, what is the…
Avaldor
  • 317
  • 2
  • 8
1
vote
1 answer

Lombok @Value annotation not generating @ConstructorProperties in Eclipse

I have the code below in a Maven project which compiles and runs from the command line (OpenJDK 15.0.2 running in Ubuntu under Windows Subsystem for Linux). It uses Lombok 1.18.20 and version 2.12.3 of the relevant Jackson libraries. Eclipse…
Jon Moore
  • 61
  • 3