Spring security tutorial

Dictionary meaning of Security: The state of being free from danger or threat. Spring security Spring security is a flexible and powerful authentication and authorization framework to create secure J2EE-based Enterprise Applications. Authentication: It is a process or action of verifying the identity of a user or process i.e. who are you? Authorization: It is a … Read more

eclipse maven spring MVC project

Eclipse maven spring mvc hello world: Eclipse provides m2eclipse plugin to integrate Maven and Eclipse together. Steps to create maven java web project in eclipse: In eclipse, click on File menu → New → Maven Project. Select maven-archetype-webapp template to create java project and Click on Next button. Now provide the group Id, artifact Id … Read more

Spring spel regex tutorial

Spring SpEL Regex: Spring SpEL provides the facility to support regular expressions using keyword “matches“. Syntax: #{‘value’ matches ‘regex’ } Example: RegexTest.java import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component;   @Component("regexTestBean") public class RegexTest { // Check if this is a digit or not? @Value("#{‘250’ matches ‘\\d+’ }") private boolean validDigit;   public boolean isValidDigit() { return validDigit; … Read more

Spring spel list map example

Spring SpEL List/Map: Spring spel provides the facility to get values from List or Map. It works same as in java. Example: MapListTest.java import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map;   import org.springframework.stereotype.Component;   @Component("mapListTestBean") public class MapListTest { private Map<String, String> map; private List<String> list;   public MapListTest() { map = new HashMap<String, … Read more

Spring spel method invocation example

Spring SpEL method invocation: Spring spel provides the facility of method invocation i.e. execute method and inject the method returned value into property. Syntax: #{beanName.methodName} Example: Address.java import org.springframework.stereotype.Component;   @Component("studentClassBean") public class StudentClass { public String getClassName(){ return "MCA Final"; } }import org.springframework.stereotype.Component; @Component("studentClassBean") public class StudentClass { public String getClassName(){ return "MCA Final"; … Read more

Spring spel bean reference tutorial

Spring SpEL Bean Reference: Spring spel provides the facility to refer a bean and nested properties using a dot (.) symbol. Syntax: #{beanName.propertyName} Example: Address.java import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component;   @Component("addressBean") public class Address { @Value("Sec-A") private String street; @Value("122001") private int postcode; @Value("India") private String country;   public String getStreet() { return street; } … Read more

Spring spel variable example

StandardEvaluationContext: The StandardEvaluationContext is a class which implements EvaluationContext interface. It uses a reflection mechanism to resolve properties or methods. We can set a variable using the method setVariable on the StandardEvaluationContext. We can use this variable in the expression by using the syntax #variableName. Example: MulitplicationTest.java public class MulitplicationTest { int num1; int num2; … Read more

Spring spel ternary operator example

Ternary operator syntax: condition ? true : false Spring SpEL Ternary Operator Example: TernaryOperatorTest.java import org.springframework.expression.ExpressionParser; import org.springframework.expression.spel.standard.SpelExpressionParser;   /** * Spring SPEL Ternary Operator test example. * @author w3schools */ public class TernaryOperatorTest { public static void main(String args[]){ //Create a parser with default settings. ExpressionParser parser = new SpelExpressionParser();   //Ternary operator expressions. … Read more

Spring spel operators example

Spring SpEL Operators: SpEL supports the mathematical operators (+, -, /, *, Spring SpEL Operators Example: OperatorTest.java import org.springframework.expression.ExpressionParser; import org.springframework.expression.spel.standard.SpelExpressionParser;   /** * Spring SPEL Operator test example. * @author w3schools */ public class OperatorTest { public static void main(String args[]){ //Create a parser with default settings. ExpressionParser parser = new SpelExpressionParser();   //Arithmetic … Read more

Spring spel hello world example

Spring SpEL: The SpEL stands for Spring Expression Language. It is a powerful expression language which supports querying and manipulating an object graph at the bean creation time or run time. It is similar to other expression languages like JSP EL, OGNL, MVEL and JBoss EL etc with some additional features like method invocation and … Read more