Make sure to read this post before raising a thread here:
Then tell us:
- What language is this for? Java
- Which rule?
java:S6857
“SpEL expression should have a valid syntax”
- Why do you believe it’s a false-positive/false-negative?
Syntax working fine for injecting directly into a Map as presented here: https://www.baeldung.com/spring-value-annotation#using-value-with-maps
- Using SonarCloud
- How can we reproduce the problem? Give us a self-contained snippet of code (formatted text, no screenshots)
public class TestConfiguration {
@Value("#{${valuesMap}}")
private Map<String, Integer> valuesMap;
}
Hello @theBlackDragon,
Thanks for the report. I was able to reproduce the issue, Here is the ticket to fix it: [SONARJAVA-4917] - Jira
Best,
Margarita
1 Like
Hi , we also noticed it happens when the default value is empty it complains of malformed property.
Eg.:
@Value("${management.metrics.server.excluded-uris:}")
private List<String> excludedUris;
Where the default would be an empty array by applying the :
1 Like