Questions tagged [configurationproperties]

89 questions
0
votes
0 answers

How to add @ConfigurationProperties annotation to service

I want to use properties from application.properties file. Before I was using @Value({"valueFromProperties} annotation but I would like to change it on @ConfigurationProperties annotation. I prepared some app with…
0
votes
1 answer

Spring naming strategy for @ConfigurationProperties

Lets say i have properties class ExampleProps: @ConfigurationProperties(prefix = "prefix.stuff") @ConstructorBinding @AllArgsConstructor public class ExampleProps { ... } Which is located in src/main/java/com/example/props/. When spring…
0
votes
1 answer

Why do I get null values after injecting bean?

When I try to inject the packagePropertiesList Bean in Operation.class, I get values from a properties file. But when I use operation.removeStudentFromList(), I get only null values. Do you see any problem here? values while injecting…
ukrotitell
  • 23
  • 3
0
votes
0 answers

@ConfigurationProperties do not seem to work when also injecting a bean

I have the following situation: @Configuration @ConfigurationProperties(prefix = "my.prefix") @ConditionalOnProperty(value = "my.prefix.should-enable", havingValue = "true") @RequiredArgsConstructor // lombok public class MyConf { @Setter …
filpa
  • 3,651
  • 8
  • 52
  • 91
0
votes
1 answer

Mocking @ConfigurationProperties in Spock with Kotlin not work

I'm trying to use Spock and ConfigurationProperties. But in my unit test, Mocking @ConfigurationProperties not work for me. Property Class @ConfigurationProperties(prefix = "jwt") @ConstructorBinding class JwtProperties( val secretKey: String, …
0
votes
1 answer

@ConfigurationProperties returns property placeholder instead of null

I have the following @ConfigurationProperties property holder: @ConfigurationProperties(prefix = "custom.service") public class CustomServicePropertyHolder { private String name; } and my application.properties looks like…
Tomas Lukac
  • 1,923
  • 2
  • 19
  • 37
0
votes
1 answer

Spring-boot: Referencing a list value within another property

I would like to be able to use a value within my list as the key to my map with spring boot properties. Is this possible? I'm new to spring-boot and using @ConfigurationProperties. I've a properties class like…
0
votes
1 answer

How to use @ConfigurationProperties annotation in Spring Boot

I am trying to apply @ConfigurationProperties annotation to get a map from application.yml file to places in code where I need it. Here is the code I have so far: application.yml repository: type: big: big small: small medium:…
user9347049
  • 1,927
  • 3
  • 27
  • 66
0
votes
1 answer

Nested @ConfigurationProperties missing from parent class

I have a somewhat complex application configuration that I'm trying to map to a POJO but it's not working. I've looked at examples and thought this was the correct way to do…
maximum
  • 1,303
  • 1
  • 8
  • 9
0
votes
0 answers

@ConfigurationProperties doesn't update if same values are injected elsewhere without annotation

I use @ConfigurationProperties with Zookeeper to update certain property values at runtime. This relevant part of the code looks like this: @Configuration public class Config { @Bean("limitedRepository") public Repository limitedRepository( …
user16036727
0
votes
0 answers

Spring Configuration Properties - Polymorphic Objects in same List

I am trying to read a list of configuration items from application.yaml into a configuration bean via @ConfigurationProperties. The list may consist of objects with a defined base type: @ConfigurationProperties("myapp") public class MyConfiguration…
user3235738
  • 335
  • 4
  • 22
0
votes
0 answers

Spring - Create ConfigurationProperties bean manually

Is it possible to create a ConfigurationProperties bean in runtime after the spring context is ready? Otherwise, is it possible to generate a ConfigurationProperties class at runtime (instrumentation) which will be collected to a…
0
votes
0 answers

Spring: Can't override properties with @ConfigurationProperties for test

I'm trying to configure property for test, using @ConfigurationProperties. My config-class with properties: @Data @Configuration @ConfigurationProperties(prefix = "data") public class TestFileSettings { private String…
Jelly
  • 972
  • 1
  • 17
  • 40
0
votes
1 answer

@ConfigurationProperties don't work in test in Spring Boot 2.4.2

I have an application that works fine in Spring Boot 2.3.8 but the @RestClientTests fails with 2.4.2 because the test objects can not be instantiated because there's no bean of the @ConfigurationProperties (which is created by the…
0
votes
0 answers

How can I convince Spring Boot to consider values from application.properties in my configuration class?

I have implemented a configuration class in Kotlin to read values from application.properties to have configurable values in the Spring Boot 2.2.2-RELEASE application. package com.foo.bar.configuration @ConfigurationProperties(prefix =…
du-it
  • 2,561
  • 8
  • 42
  • 80