Tuesday, 18 December 2012

Spring IoC Constructor Injection

Posted by Naveen Katiyar On 03:45 7 comments
Spring IoC Constructor Value Injection Spring IoC Constructor Value Injection is a method of constructor injection in which the value of the attributes of a bean are set using constructor of the class. That means the constructor of the bean must be defined to accept attributes values and set the values to bean properties. We will see the method of using Spring IoC Constructor Value Injection to set dependencies in Person bean. Person Bean Code (Person.java)  package com.naveen.beans; public...

Sunday, 16 December 2012

Spring IoC Setter Injection

Posted by Naveen Katiyar On 21:10 1 comment
Spring IoC setter value injection  We will learn the process of setting property values of a bean using Spring IoC Setter Value Injection. For Spring IoC Setter Value Injection to work the bean class must contain setter of the property present. In the following example we will consider a Person class which has two properties to construct the name of the person. We will set the property values in Spring IoC Bean Configuration file and the print the name of the person. Person Bean class...

Thursday, 13 December 2012

Initializing a Spring IoC Bean

Posted by Naveen Katiyar On 21:37 3 comments
 Using Initialization method to initialize a Spring IoC Bean With the previous tutorial, you know the process of registering a bean class with Spring IoC container using xml configuration files. In this tutorial we will see how to define an initialization method of bean to Spring IoC, so that Spring IoC container invokes the method after creating instance of the bean to perform some initialization work. Tools Used: Spring IoC Framework 3.0.3 In our example, we will define an initialization...

Getting Started with Spring IoC

Posted by Naveen Katiyar On 02:32 No comments
Configuring Spring Bean and creating Spring Bean instance This quick start will make you go through the implementations of Spring IoC example and illustrate how to configure your Spring Bean in Spring Configuration file and how to get instance of the bean using Spring IoC container. The example will take a example of Cat class (Cat.java) that will implement Speaks interface (Speaks.java) . Speaks Interface (Speaks.java) package com.naveen.beans; public interface Speaks {    ...

Wednesday, 12 December 2012

Introduction to Spring IoC

Posted by Naveen Katiyar On 23:58 1 comment
What is Spring IoC? Before going through the Spring IoC tutorial, we must know what IoC is and why we use it in real life project development. IoC or Inversion of Control, is also known as Dependency Injection, is used to create loosely coupled software components. Here, loosely coupled means less dependent software components. Let us illustrate it with an example: There is a Report class used to generate reports...

Spring MVC Ajax Tutorial

Posted by Naveen Katiyar On 22:47 2 comments
Ajax with Spring MVC 3 Using Annotations and JQuery Its always been fun for me to work with Ajax! Is not it ? I will make it easy for you  to use Ajax with Spring MVC 3 and JQuery. This post will illustrate you how to use Ajax in real life practices of industrial coding. As usual, we will take an practical example of Ajax in Spring MVC 3 framework and will implement it and I will make the implementation easy by...

URL Permission Based Security

Posted by Naveen Katiyar On 05:07 No comments
URL Permission Based User Interface Creation in Spring Security In the previous tutorial, we learned how to customize jsp out put based on the role of the logged in user with the help of the Spring Security JSP Taglibs. Now, we will learn the way to customize the jsp page on the basis of a secure url. That means if the logged in user will have permission to visit the url specified in the taglib attribute, the particular jsp segment will be rendered otherwise, the segment will not shown to...

Role Based Spring Security

Posted by Naveen Katiyar On 04:51 No comments
Role Based User Interface Creation Using Spring JSP Taglibs Spring Security provides jsp taglibs for customizing User Interface according the authenticated user’s role. We can make it possible to show some ui portion to user with role admin and not to others. This tutorial is based on the previous Spring Security Tutorials. You should first read Getting Started with Spring Security tutorial and then read this tutorial for better understanding. Tools Used: Spring MVC 3.0.3 Spring JDBC...