• spring,  springExample

    Spring first HelloWorld example

    Here I will try to walk through the Spring3.0 first example, which will help you in understanding the spring workflow. and classes and xml required to complete one request process, here we will work on sample java application and not a web application. Here we are creating following components to run Spring java application, but before starting please read through the configuration required for Spring3, this will help you setup spring in eclipse.Lets create a simple class with sayHello method in it, and put some instructions so that you can see something happening in console here I have put SOP which will print a line Hello from Spring 3.0.Spring3HelloWorld.java package…

    Comments Off on Spring first HelloWorld example
  • spring,  springExample

    Spring first time Configuration and set up IDE

    We have divided Spring Configuration in below steps so please be sure these are available before jumping into Spring Example or Spring Application to work: JDK 5+ Eclipse Setup. Spring 3.0 Download common-logging download Create Project and add lib in Eclipse JDK 5+, Spring 3.0 is based upon JDK 5, so it will require to have JDK 5 or after version to build an Spring Application. if you don’t have JDK, please download it from here.Check Java Version by java -version Eclipse Setup, Download the eclipse at http://www.eclipse.org/downloads/Common-logging download, Spring use common logging for making logs so please download it from http://commons.apache.org/downloads/download_logging.cgi, else you will get an error like below:Exception in thread “main”…

    Comments Off on Spring first time Configuration and set up IDE
  • spring

    Spring Overview

    Spring framework makes developing enterprise application easier and simple to code, now days Spring working in full swing and now each java application demand Spring. Lets discuss the life of developers without the Spring Framework then will jump into Spring so that we can easily understand the difference and benefit of Spring in an application. Life without Spring– I will take my own example, when I was working on my first application for enterprise application, I have to create a component for my application which will be performing the customer management, at that time EJB was on boom, so I have chosen EJB to create this component, to start I have created…

    Comments Off on Spring Overview
  • spring,  Spring Interview Questions

    Types of IOC(Inversion of Control) or DI(Dependency Injection)

    There are two types of dependency injection: setter injection and constructor injection. Setter Injection: Normally in all the java beans, we will use setter and getter method to set and get the value of property as follows: public class namebean { String name;     public void setName(String a) {             name = a; }     public String getName() {     return name; }} We will create an instance of the bean ‘namebean’ (say bean1) and set property as bean1.setName(“tom”); Here in setter injection, we will set the property ‘name’ in spring configuration file as showm below: <bean id=”bean1″ class=”namebean”> <property name=”name” > <value>tom</value>…

    Comments Off on Types of IOC(Inversion of Control) or DI(Dependency Injection)
  • spring,  Spring Interview Questions

    IOC(Inversion of control) Vs DI(Dependency injection)

    IOC and DI are one of the same thing in aspects of Spring Framework, Both are meant to be for same functionality. Dependency injection (DI) is a programming design pattern and architectural model, sometimes also referred to as inversion of control or IOC, although technically speaking, dependency injection specifically refers to an implementation of a particular form of IOC.  Dependency Injection describes the situation where one object uses a second object to provide a particular capacity. For example, being passed a database connection as an argument to the constructor instead of creating one internally. The term “Dependency injection” is a misnomer, since it is not a dependency that is injected,…

    Comments Off on IOC(Inversion of control) Vs DI(Dependency injection)
  • spring,  Spring Interview Questions,  springExample

    What is Inversion Of Control(IOC)?

    Inversion of control or dependency injection (which is a specific type of IoC) is a term used to resolve objectdependencies by injecting an instantiated object to satisfy dependency as opposed to explicitly requesting anobject. So objects will not be explicitly requested but objects are provided as needed with the help of an Inversion Of Controller container (e.g. Spring etc). This is analogous to the Hollywood principal where the servicing objects say to the requesting client code (i.e. the caller) “don’t call us, we’ll call you”. Hence it is called inversion of control. Many of us are familiar with the software development context where client code collaborates with other dependent objects (or servicing objects) by…

    Comments Off on What is Inversion Of Control(IOC)?
  • Interview Questions,  spring,  Spring Interview Questions

    Differences between Object Oriented Programming and Aspect Oriented Programming?

    Object Oriented Programming (OOP) Works on System level code, OOP looks at an application as a set of collaborating objects. OOP code scatters system level code like logging, security etc with the business logic code. OOP works on elements like classes, objects, interfaces etc. Provides benefits such as code reuse, flexibility, improved maintainability, modular architecture, reduced development time etc with the help of polymorphism, inheritance and encapsulation. Aspect Oriented Programming (AOP) Aspect Oriented Programming works at the complex software system as combined implementation of multiple concerns like business logic, data persistence, logging, security, multithread safety, error handling, and so on. Separates business logic code from the system level code. In fact one concern remains unaware of other concerns. AOP has…

  • Interview Questions,  spring,  Spring Interview Questions

    Benefits of Aspect Oriented Programming

    Benefit of Aspect Oriented Programming Aspect Oriented Programming helps overcome system level coding i.e. Logging, Transaction or Security management problem by centralizing these cross-cutting concerns. Aspect Oriented Programming addresses each aspect separately in a modular fashion with minimal coupling and duplication of code. This modular approach also promotes code reuse by using a business logic concern with a separate logger aspect. Make easier to add newer functionality’s by adding new aspects and weaving rules and subsequently regenerating the final code. This ability to add newer functionality as separate aspects enable application designers to delay or defer some design decisions without the dilemma of over designing the application. Rapid development of evolutionary prototypes using OOP by focusing only…

    Comments Off on Benefits of Aspect Oriented Programming
  • Interview Questions,  spring,  Spring Basics,  Spring Interview Questions

    What is IOC also known as inversion of control?

    Inversion of control or dependency injection (which is a specific type of IoC) is a term used to resolve objectdependencies by injecting an instantiated object to satisfy dependency as opposed to explicitly requesting anobject. So objects will not be explicitly requested but objects are provided as needed with the help of an Inversion Of Controller container (e.g. Spring etc). This is analogous to the Hollywood principal where the servicing objects say to the requesting client code (i.e. the caller) “don’t call us, we’ll call you”. Hence it is called inversion of control. Many of us are familiar with the software development context where client code collaborates with other dependent objects (or servicing objects) by…

    Comments Off on What is IOC also known as inversion of control?
  • Interview Questions,  spring,  Spring Interview Questions

    What is Aspect Oriented Programming (AOP)?

    Aspect-Oriented Programming (AOP) complements OOP (Object Oriented Programming) by allowing thedeveloper to dynamically modify the static OO model to create a system that can grow to meet new requirements. AOP allows you to dynamically modify your static model consisting mainly of business logic to include the coderequired to fulfill the secondary requirements or in AOP terminology called cross-cutting concerns (i.e.secondary requirements) like auditing, logging, security, exception handling etc without having to modify theoriginal static model (in fact, we don’t even need to have the original code). Better still, we can often keep thisadditional code in a single location rather than having to scatter it across the existing model, as we…

    Comments Off on What is Aspect Oriented Programming (AOP)?