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

958 questions
0
votes
2 answers

Spring - geting system env variable in xml causes Null pointer Exception

In my spring app, for database password, I have used This throws null pointer Exception. I am using windows 7, I had set the env variable though advanced settings option in…
0
votes
1 answer

Why does spring's getLocalHost throw an exception on my server?

I can build and run this application locally on my Windows machine using Tomcat 7 and Java 7. But when I deploy the war file on a linux machine using Tomcat 7 and Java 7, an exception is thrown. The problem seems to be in the SPeL function…
jeph perro
  • 6,242
  • 26
  • 90
  • 124
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
  • 5,172
  • 7
  • 40
  • 63
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
  • 5,172
  • 7
  • 40
  • 63
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
  • 5,172
  • 7
  • 40
  • 63
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
  • 5,172
  • 7
  • 40
  • 63
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
  • 21,611
  • 40
  • 152
  • 243
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,298
  • 5
  • 31
  • 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
  • 2,738
  • 24
  • 91
  • 157
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…
Beast
  • 639
  • 2
  • 14
  • 29
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
  • 1,041
  • 15
  • 27
0
votes
1 answer

SpEL using functions

I add to my xml next bean: And now, when I run…
Lesya Makhova
  • 1,340
  • 3
  • 14
  • 28