Archive | Spring

RSS feed for this section

Spring + Log4j + Maven Example

In this tutorial, I will show you how to integrate Spring 3 with Log4j. Tools and technologies used : Spring Log4j Maven Eclipse Following example demonstrates a simple Hello World web application using Spring MVC that will show logging message on Console. First create a new Dynamic Web Project and configure it as Maven Project. [...]

Continue Reading ... Comments { 2 }

Spring + Hibernate + MySql + Maven Example

In this tutorial, I will show you how to integrate Hibernate with Spring 3. Tools and technologies used : Hibernate Spring MySql Maven Eclipse First create a new Dynamic Web Project and configure it as Maven Project. For Reference, Click Here Add the following dependencies in pom.xml 1. Sql Script Use the following Sql Script [...]

Continue Reading ... Comments { 11 }

Spring <form:textarea> Tag

In this Spring example, you will learn how to create a HTML textarea with Spring <form:textarea> tag. For Example : In order to use the Spring Form Tags you need to include the following taglib directive in the jsp page. First create a new Dynamic Web Project and configure it as Maven Project. For Reference, [...]

Continue Reading ... Comments { 0 }

Collections in SpEL

You can reference a single member of a collection in SpEL, just like in Java. But SpEL also has the power to select members of a collection based on the values of their properties. It can also extract properties out of the collection members into a new collection. Accessing Collection Members The most basic thing [...]

Continue Reading ... Comments { 0 }

Expression Evaluation using Spring’s Expression Interface

ExpressionParser parses expression strings into compiled expressions that can be evaluated. It also supports parsing templates as well as standard expression strings. Following code demonstrates few examples of “ExpressionParser” interface. You can download the source code of this example here.

Continue Reading ... Comments { 0 }

Arithmethic Operations using Spring Expression Language

SpEL supports all of the basic arithmetic operators that Java supports, plus the carat (^) operator for performing a power of operation. Following example demonstrates arithmetic operations using Spring Expression Language. First create a new Java Project and configure it as Maven Project. For Reference, Click Here Add the following dependencies in pom.xml 1. POJO [...]

Continue Reading ... Comments { 0 }

Operators in Spring Expression Language

SpEL offers several operations that you can apply on values in a SpEL expression. Table 1.1 SpEL Operators Operation type Operators Arithmetic +, -, *, /, %, ^ Relational , ==, =, lt, gt, eq, le, ge Logical and, or, not, | Conditional ?: (ternary), ?: (Elvis) Regular expression matches Arithmetic Operators SpEL supports all [...]

Continue Reading ... Comments { 0 }

Invoke method using Spring Expression Language

You can also invoke a method using Spring Expression Language. Following example demonstrates how to invoke method using Spring Expression Language. First create a new Java Project and configure it as Maven Project. For Reference, Click Here Add the following dependencies in pom.xml 1. POJO Create Instrument Class as following 2. Configuration Create Spring-Bean.xml and [...]

Continue Reading ... Comments { 0 }

Injecting values using Annotation (SpEL)

When using annotation-style value injection, we just need to substitute the value annotations with the SpEL expressions. Following example demonstrates injecting values with Annotation based configuration using Spring Expression Language. First create a new Java Project and configure it as Maven Project. For Reference, Click Here Add the following dependencies in pom.xml 1. POJO Create [...]

Continue Reading ... Comments { 0 }

Injecting values using XML (SpEL)

We can define the bean in the XML configuration and use SpEL to inject the bean’s properties into the dependent bean. Following example demonstrates injecting values with XML based configuration using Spring Expression Language. First create a new Java Project and configure it as Maven Project. For Reference, Click Here Add the following dependencies in [...]

Continue Reading ... Comments { 0 }