View RSS Feed

Spring Framework

SpringSource Spring Framework tutorials and examples. Focusing on Spring 3 and above.

  1. Advanced Uses of SpEL

    by , 11-16-2011 at 05:50 PM
    There are a number of operations that you can apply on values as well as class scoped methods and constants using SpEL. Consider for example doing basic math operations on values. SpEL supports all the basic arithmetic operations that are supported in Javaís libraries. Consider that if you want to use constants or class-scoped methods you will need to use the T() operator. Below is an example of how it is to be used:

    T(java.lang.Math)

    The creates a Class object that ...
  2. More Simple SpEL Expressions

    by , 11-16-2011 at 05:48 PM
    Another basic thing that a SpEL expression can do is to reference another bean by its ID. With this functionality it is possible to use SpEL to wire one bean into another beanís property by using the bean ID as the SpEL expression:

    Java Code:
    <property name="engine" value="#{hybrid}"/>
    As you can see, weíre using SpEL to wire the bean whose ID is "hybrid" into an engine property. Now it is possible to do this without SpEL, and you would get ...
  3. The Basics of SpEL

    by , 11-16-2011 at 05:44 PM
    The goal of a SpEL expression is to arrive at some value after evaluation. In the course of calculating that value, other values are considered and operated upon. The simplest kinds of values that SpEL can evaluate may be literal values, references to a beanís properties, or perhaps a constant on some class.

    The most basic type of SpEL expression is one that contains only a literal value. A literal value would be a perfectly valid SpEL expression:

    Java Code:
    <property name="message"
    ...