I have a Spring Boot application with a YAML configuration that contains a feature list like this: I would like to use @ConditionalOnExpression to conditionally initialize beans related to those features, identifying them by keys. Since “features” property is a list, it seems I need collection sel…
Tag: spring-el
Set environment property in yaml using placeholder
I have a map propMap, set as a PropertySource in the Environment object in my Spring Boot application. What would be the correct notation to access a key in the map from the .yaml file? I tried using username: “#{propMap.[‘username’]}” but doesn’t seem to work. I tried few others…
Spring SPEL collection projection
A simple question on SPEL collection selection. Look at section 10.5.17 Collection Selection on this page https://docs.spring.io/spring/docs/4.3.10.RELEASE/spring-framework-reference/html/expressions.html What i need is the selection ‘Serbian’ to come from outside and not be a fixed hard coded Str…
Injecting property in Springboot using @Value annotation
I am using Spring and Java for an application, and I want to use the @Value annotation to inject the value of the property, my use case is that I want first to check if that property exists as system property (so it takes priority), and otherwise default to a configuration property (existing in the properties…
convert SpEL output to long to use as an annotation argument
Currently, I can use String arguments using SpEL as follows: It works fine but if I want a long constant it will not be work : So, How to fix it? Also, I cannot give Long and it accepts only long edit : I have gone through many similar SpEL questions but there were no applicable solutions for my case.
How to fill HashMap from java property file with Spring @Value
Is it possible to use Spring @Value, to map values from properties file to the HashMap. Currently I have something like this, and mapping one value is not a problem. But I need to map custom values in HashMap expirations. Is something like this possible? Property file: ‘my_service.properties’ Is i…