Questions tagged [spring-el]

The Spring Expression Language (SpEL for short) is a powerful expression language that supports querying and manipulating an object graph at runtime. The language syntax is similar to Unified EL but offers additional features, most notably method invocation and basic string templating functionality.

Spring Expression Language was introduced in Spring 3.0.x

The Complete reference can be found in the reference documentation.

Guides:

Video tutorial on Spring Framework

Blog:

Related tags

866 questions
0
votes
2 answers

SpEl (Spring Expression Language) Extracting Substring

I have a 'relative-filename' parameter in a Spring Integration Message Header. It could be formatted like "/tmp/frodo/files/pending/whatever.xml" or "/tmp/wilfred/files/completed/new/another.xml" The portion before "files" can be of variable…
0
votes
1 answer

Enum in SpEL for grails spring security annotation?

Assuming a grails (v2.3.x) custom class created and setup in a way that mimics the java way outlined by @JamesWatkins in this post, it is simple to annotate a method with a static…
mdlandon
  • 125
  • 1
  • 6
0
votes
1 answer

Can SpEL use a special date format for a bean property?

I have a bean with a date property called birthday: Can I specify a date format for my bean, in order to get 6th December or 12th June or is the default one always used?
user998692
  • 4,970
  • 7
  • 38
  • 58
0
votes
1 answer

How does @Value work in SpEL?

I have a class A with a date field annotated with @Value to take as default value the current date. When I create a bean in an XML file, this field appears to be initialized with the current date, as expected. When I create a new object with new…
user998692
  • 4,970
  • 7
  • 38
  • 58
0
votes
1 answer

SpEL restrictions in annotations?

Can someone use a bean reference in a SpEL expression in an annotation? (in XML it is definitely possible using the bean id in #{}). In general, are there any restrictions/limitations for SpEL expressions used in XML files vs. those used in…
user998692
  • 4,970
  • 7
  • 38
  • 58
0
votes
1 answer

SpEL: how does "matches" work?

I have been through the documentation for Spring Expression Language and I saw that it has operator matches for regular expression. Does anyone know if the algorithm used for it is the same greedy one as for matches in Java language?
user998692
  • 4,970
  • 7
  • 38
  • 58
0
votes
1 answer

Spel bean references unavailable when using NamespaceHandler and BeanDefinitionParser

I'm using NamespaceHandler and BeanDefinitionParser based on reference and I'd like to use Spel with bean references. The problem is, that I cannot reach app context in NamespaceHandler or BeanDefinitionParser due to the lifecycle phase we're in, so…
lisak
  • 20,109
  • 39
  • 146
  • 236
0
votes
2 answers

Using Spring Expression Language to define xml attribute

Here is my problem: I have to read a property (activemq.connector.port) and add 2 to that and use that to set an attribute (connectorPort) on the bean ManagementContext. Here the property comes from a file or it could be system property. Spring does…
FourOfAKind
  • 2,078
  • 5
  • 27
  • 34
0
votes
1 answer

ternary operator in spring configuration file

I have a situation where I need to check the profile maven is running on and then according to that I need to configure task scheduler. There are two profiles one is 'global' and the other one is 'nonglobal', what I did is:
Maverick
  • 3,299
  • 22
  • 82
  • 144
0
votes
1 answer

Issue in combining logical operation in Spring expression language

I am new to spring and using the spring version 3.2.2. I have tried to create few examples using the spring expression language(SPEL). But i am facing issue while using logical operator in the spring configuration file. Please find the below…
Jinesh Parikh
  • 559
  • 1
  • 9
  • 26
0
votes
1 answer

Using SpEL to copy references of a beans is not working

I have been experimenting around with Spring. I wish to copy a bean's value and reference properties for another bean by making use of SpEL. Consider this bean:
0
votes
1 answer

Referencing Map Elements in SpEL - Spring FTP dynamic remote directory creation

I'm using outbound-channel-adapter of spring integration ftp
0
votes
1 answer

Using a static variable value in Qualifier annotation

Is it possible to pass a static variable defined in a class as argument to @Qualifier annotation? I tried the below format and a few other variations, but nothing worked. @Qualifier("T(com.test.Constants).BEAN_NAME") Spring-el works in @Value…
dsatish
  • 971
  • 14
  • 26
0
votes
1 answer

How to pass a null variable into a Spring Expression in JSP

I am using the tag in a JSP: Where today is a java.util.Date. Everything works just fine, as long as the today variable is not null. When today is null, I get…
matt forsythe
  • 3,153
  • 1
  • 14
  • 27
0
votes
1 answer

SpEL using functions

I add to my xml next bean: And now, when I run…
Lesya Makhova
  • 1,190
  • 2
  • 13
  • 27