question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

@Value annotation should be able to inject List<String> from YAML properties [SPR-11759]

See original GitHub issue

Adam Berlin opened SPR-11759 and commented

Yaml file —

 
foobar:  
  ignoredUserIds:
    - 57016311
    - 22588218

Class —

 
    
public class Foobar {
    @Value("${foobar.ignoredUserIds}")
    List<String> ignoredUserIds;
}
 

Error —

 
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: java.util.List foobar.Foobar.ignoredUserIds; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'foobar.ignoredUserIds' in string value "${foobar.ignoredUserIds}"


Reference URL: https://github.com/spring-projects/spring-boot/issues/501

21 votes, 21 watchers

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Reactions:4
  • Comments:18

github_iconTop GitHub Comments

25reactions
komidawicommented, Feb 3, 2021

2021 and it’s still needed 😉

14reactions
abccbaandycommented, May 30, 2019

2019 and I need this feature. @Value >>>>> @ConfigurationProperties when there is only one field : private List<String> someList;

Why I need a Class when I only have one field?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Spring Boot: read list from yaml using @Value or ...
I have been able to read list from properties like below way- ... It says Could not resolve placeholder 'fruits' in value "${fruits}"....
Read more >
A Quick Guide to Spring @Value - Baeldung
In this quick tutorial, we're going to have a look at the @Value Spring annotation. This annotation can be used for injecting values...
Read more >
Spring Boot @Value Annotation - Dan Vega
In this article you will learn about how to set configuration properties and values and then inject them into your application using the...
Read more >
Spring @Value Annotation Guide - Coding N Concepts
Learn how to inject values for Primitives, List, Map, Date with inline values and from property file using @Value Annotation.
Read more >
Spring @Value annotation tricks - DEV Community ‍ ‍
@Value annotation can be used within classes annotated with ... The property value is injected at runtime from the property file to the ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found