To automatically wire a bean annotated with @ConfigurationProperties into SpEL expression in Spring Boot version 2.2.*, you can use the #{…} syntax with the bean name. For example, if you have a ConfigurationProperties bean named MyConfigProperties, you can refer to it in an expression like this:
@Value("#{myConfigProperties.someProperty}") private String someValue;
This will inject the value of the “someProperty” field of the MyConfigProperties bean into the “someValue” variable. Note that you need to provide the name of the bean in the expression, not the class name.
Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss
Asked: 2022-03-31 11:00:00 +0000
Seen: 8 times
Last updated: Jan 14 '23
What is the regular expression to eliminate the characters \n and \t?
How can the issue of text size error be resolved in an After Effect expression?
What does the expression [rep(token, nrow(.)), ] signify in R?
How can I retrieve the headings for a table in IMPORTXML on Google Sheets?
What is the regular expression that will only allow decimal input?
What is the process of replacing regular expressions with data in Visual Studio Code?