I need to set data from application.yml file to my config class but when I trying to do it I get an error:
TestConfig is annotated with @ConstructorBinding but it is defined as a regular bean which caused dependency injection to fail.
My application.yml file looks like the following:
test:
app:
id: app_id
My TestConfig class looks like this:
@Configuration
@ConfigurationProperties(prefix = "test.app")
@ConstructorBinding
public class TestConfig {
private final String id;
public TestConfig(String id) {
this.id = id;
}
}
I'm trying to do like this but it doesn't work for me.
Where I was wrong?