• Home
    Home This is where you can find all the blog posts throughout the site.
  • Categories
    Categories Displays a list of categories from this blog.
  • Bloggers
    Bloggers Search for your favorite blogger from this site.
  • Login


Posted by on in Spring
  • What is Spring ?
    Spring is an open source framework created to address the complexity of enterprise application development. One of the chief advantages of the Spring framework is its layered architecture, which allows you to be selective about which of its components you use while also providing a cohesive framework for J2EE application development.
  • What are the advantages of Spring framework?
    The advantages of Spring are as follows:
    Spring has layered architecture. Use what you need and leave you don't need now.
    Spring Enables POJO Programming. There is no behind the scene magic here. POJO programming enables continuous integration and testability.
    Dependency Injection and Inversion of Control Simplifies JDBC
    Open source and no vendor lock-in.
  • What are features of Spring ?
    Lightweight: spring is lightweight when it comes to size and transparency. The basic version of spring framework is around 1MB. And the processing overhead is also very negligible.
    Inversion of control (IOC):Loose coupling is achieved in spring using the technique Inversion of Control. The objects give their dependencies instead of creating or looking for dependent objects.
Continue reading
Hits: 4609 0 Comments

Posted by on in Spring


Aspect Oriented programming (AOP) is often defined as a programming technique that promotes separation of

system services (or concerns) from the business logic The different system services (concerns) are loggrng.

trasaction managent exceptions security etc. These system services are common reffered to as across cutting

The DI helps us decouple our application object from each other, AOP helps us decouple cross-cutting concerns

from the objects that they effect.

AOP makes it possible to modularize these concerns and them declaratively to the components.

The Advantages with AOP

1.. The business components look very clean having only business related statements without systems services code

2. All system services are implement in a common place,Which simlifies code maintenance.

3. We can make changes in a common locations os that the changes are reflected across all components

4. Promotes re-usability.

5. Clear demarcation (separation) among developers.

AOP Terminology


Every system service is an aspect which is written in one place,but can be integrated with components.


Advice is the actual implementation of an aspect it defines the job that an aspect will perform.Advice define both

what and when of an aspect.

Spring aspect can work with live kind of advice:

Advice type Interface Description

org.springrframe work.aop.method Before Advice

Called before target method is invoked
After org.springrframe work.aop.After Advice Called after the target method returns regardless of the outcome
After Returning org.springrframe work.aop.After Returning Advice Called after target method completes successfully.
Around org.aopalliance.Intercept.method Incerceptor Both Before and After
After throwing org.springrframe work.aop.Throws Advice Called when target method throws an exception.

Continue reading
Hits: 2963 0 Comments

Posted by on in Spring


The Spring MVC helps us to build web based application that are flexible and loosely coupled.

Conclusion:The spring moves requests around between a dispatcher servlet,handler mapping,controller,and view resolver. will parse web.xml file.

Whenever Spring MVC application is deployed into servlet container,then the container


It is front controller servlet which delegates request to controller(business component).

The DispatcherServlet will consult a ViewResolver to map the logical view name to specific physical response page.

Handler Mapping

It is used to decide one controller among many controller using urlpath.

Handler Mapping Implementation Description


Maps controller to URLs that are based on controller bean name in spring configuration files component contains only database operations without transactional statements.


Same as above except the bean names arenot required to follow URl conventions.


Maps controller to URLs that are based on controller class name as the basis for their URLs.

Maps reuest to controller and controller methods that are annotated with @RequestMapping.

SimplerUrlHandlerMapping Maps controllers to URLs using a property collection defined in the spring application context.


Continue reading
Hits: 1540 0 Comments

Posted by on in Spring


The Spring framework supports both Programmatic and Declarative transactions.

In case of Programmatic transaction,the business component contains both database opeartions as well as transactional statements.

In case of Declarative transactions,the business component contains only database operations without transactional statements.The transactional statements are implemented as transaction advice and merged using AOP.

Difference between Programmatic and Declarative transactions:

Programmatic Transactions Declarative Transactions

Business component contains both database operations as well as transactional statements.

Business component contains only database operations without transactional statements.

Gives fine grained control since single method may have multiple transactions.

Convenient to use because of AOP.

Propagation Behaviour(or Transaction Attributes)

Method1 begins a transaction and invokes method2.When method2 executes, does it run within the method1

transaction or does it execute in a new transaction?The answer depends on the transaction attribute of method2.

A tranbsaction attribue may have one of the following values:

  • Required
  • ReguiresNew
  • Supports
  • NotSupported
  • Mandatory
  • Never
  • Nested


If the method1 is running within a transaction and invokes the method2, the method2 executes within the

method1 transaction. If the method1 is not associated with a transaction, the container starts a new transaction

before running the method 2.


If the methos1 is running within a transaction and involkes the method2, the container does the following steps:

1. Suspends the method1 transaction

2. Starts a new transaction

3. Delegates the call to the method 2

4. Resumes the method1 transaction after the method 2 completes.

If the method1 is notassociates with a transaction, the container starts a new transaction before running the method 2.

You should use the RequiresNew attribute when you want to ensure taht the method2 always runs within a new transaction

Continue reading
Hits: 2702 0 Comments