Constructor Injection

In our previous post we have see Setter Injection. Now we will have a look at Constructor Injection Constructor Injection During instantiation we can also set the predefined values with the help of constructor. So lets change our Triangle class to use Constructor Injection. Triangle.java

In above code we…

Continue reading

ApplicationContext and Property Initiallization

We can say ApplicationContext is the super set of BeanFactory. ApplicationContext does all that a BeanFactory does but in addition to it ,it has some additional functinalities. It has features like Event Notification,AOP,Support for message Resource,i18 and more… So lets refactor our DrawingApp class to use ApplicationContext. Like BeanFactory,ApplicationContext is…

Continue reading

Writing Code using Bean Factory

We would first require two java classes. Triangle.java

DrawApp.java

This is the usual way to call draw method. Now lets do it in the spring way Now we will be not be using new keyword,Inspite we will use BeanFactory to create the new object. BeanFactory is an Interface…

Continue reading

Spring Bean Factory

When we think of Spring ,Dependency Injection is the first thing that comes to our mind. And DI concept is possible because Spring is a container of beans and Spring behaves as factory of beans. Let see what is means by Container Spring Container: What is a container ? Lets…

Continue reading

Spring Core – Setup

Steps to setup Eclipse for core Similar posts: Introduction to Spring Spring Modules IOC and Dependency Injection Spring Core Interview Questions and Answers Spring First Example, Setter Injection With Primitive Values

Continue reading

Dependency Injection explained

Dependency Injection Let understand the dependency injection Consider we have a Circle Object and a Triange Object and we have a application class so we can create a circle using circle object and simillarly we can create a Triangle using triangle object in our application class so the code will be like…

Continue reading

Exception Handling – part 2 – Globally

In our previous article we have seen how to handle exception that are thrown from our controller class,but with that approach,the exceptions can be handle only in that particular controller class and if any other controller class throws the same exception than it will not be handled and user will…

Continue reading

Exception Handling – part 1

The Spring framework provides an annotation @ExceptionHandler that can be used to intercept uncaught/unhandled exceptions in request mapped functions in controllers. When a user hits a url one of the request handling method of the controller class handle it and process it,but if while processing due to some reason it…

Continue reading

Interceptors – part 1

Interceptor in Spring Framework: Spring Interceptors has the ability to pre-handle and post-handle the web requests. Each interceptor class should extend the HandlerInterceptorAdapter class. Here we will create an Interceptor by extending the HandlerInterceptorAdapter class. You can override any of the three callback methods preHandle(), postHandle() and afterCompletion(). As the…

Continue reading