The Spring Framework is an open source application framework that aims to make J2EE development easier. Unlike single-tier frameworks, such as Struts or Hibernate, Spring aims to help structure whole applications in a consistent, productive manner, pulling together best-of-breed single-tier frameworks to create a coherent architecture. The technolo...

Read More

Dependency Injection goes a long way towards delivering the ideal of a fully featured application framework enabling a POJO programming model. However, configuration management isn't the only issue; you also need to provide declarative services to objects. It''s a great start to be able to configure POJOs-even with a rich network of collaborators-w...

Read More

Handler interceptors are used when you want to apply specific functionality to certain requests. Handler Interceptors should implement the interface HandlerInterceptor. Three methods are defined: preHandle(..) is called before the actual handler is executed; postHandle(..) is called after the handler is executed; afterCompletion(..) is called after...

Read More

DispatcherServlet acts as the front controller. Simplified actions taken by DispatcherServlet are listed below: STEP 1: All requests arrive at the DispatcherServlet (Front Controller). STEP 2: DispatcherServlet resolves theme and locale as configured. STEP 3: Find’s appropriate Controller (Handler) to handle the request. (pre-processors and post-pr...

Read More

Different types of scope for Spring Bean are listed below:  singleton : Return a single bean instance per Spring IOC container. prototype : Return a new bean instance each time when requested. request : Return a single bean instance per HTTP request. session : Return a single bean instance per HTTP session. global session : Return a single bean ins...

Read More

Dependency Injection (DI) refers to the process of supplying an external dependency to a software component. DI can help make your code architecturally pure. It aids in design by interface as well as test-driven development by providing a consistent way to inject dependencies. For example, a data access object (DAO) may depend on a database connect...

Read More

A BeanFactory is like a factory class that contains a collection of beans. The BeanFactory holds bean definitions of multiple beans within itself and then instantiates the bean whenever asked for by clients. BeanFactory is able to create associations between collaborating objects as they are instantiated. This removes the burden of configuration fr...

Read More

A BeanFactory is fine to simple applications, but to take advantage of the full power of the Spring framework, you may want to move up to Springs more advanced container, the Application Context. On the surface, an application context is same as a bean factory. Both load bean definitions, wire beans together, and dispense beans upon request. But it...

Read More

The three commonly used implementation of Application Context as below   ClassPathXmlApplicationContext : It Loads context definition from an XML file located in the classpath, treating context definitions as classpath resources. The application context is loaded from the application's classpath by using the code. ApplicationContext context = new...

Read More

Different types of advice available in AOP are as below: Before advice: Advice that executes before a join point, but which does not have the ability to prevent execution flow proceeding to the join point (unless it throws an exception). After returning advice: Advice to be executed after a join point completes normally: for example, if a method re...

Read More

In Spring MVC application, MultiActionController is used to group related actions or behaviour into a single controller, the method handler have to follow below signature: public (ModelAndView | Map | String | void) actionName( HttpServletRequest, HttpServletResponse [,HttpSession] [,CommandObject]); Now let us try to understand MultiActionCon...

Read More

We have already seen how we can configure MultiActionController. PropertiesMethodNameResolver, a flexible MultiActionController method name resolver, to define the mapping between the URL and method name explicitly. See following example : Now let us try to understand PropertiesMethodNameResolver with an example, first we will define our MultiActio...

Read More

Spring beans are just object instances that instantiated, assembled, and otherwise managed by a Spring IoC container. They are created and wired by the framework and put into a "bag of objects" i.e. Spring Container from where you can get them later. When you create a bean definition(XML configurations or annotations) what you are actually creating...

Read More

In this tutorial we will demonstrate how to use Jackson 2.x to convert Json to Java Object and Java Object to Json. Adding Jackson 2 Dependency Using Maven:  com.fasterxml.jackson.core jackson-databind 2.6.3 Using jackson-databind, it will do...

Read More

In this article we will discuss about the Lifecycle callbacks methods available in Spring Container. Now to start the discussion we need to know “What is Lifecycle callbacks for Spring beans?” Lifecycle callbacks are the ways by which beans can interact with the container management in different phases of the lifecycle of that bean. As an example: ...

Read More

@ModelAttribute refers to a property of the Model object (the M in MVC). The primary objective of this annotation is to bind the request parameters or form fields to a model object. Basically in Spring MVC web application the @ModelAttribute annotation can be used in following ways. It can be used to pass data to JSP before it loads. This ensures t...

Read More

This is a guide to create a simple RESTful web service with Spring-boot. Here we will build a service that will accept HTTP GET requests and sends a JSON response. We are going to create a Student master list and expose a REST api to search in the list of students.  Use the Students REST API : To interact with the Students REST API, you send HTTP G...

Read More

In The previous post Getting Started · Building an Application with Spring Boot  We have already created a basic spring-boot application. Now here we will re-factor the code step by step to create a more concise application.  In our previous example we have created a simple StudentAPI Rest Controller, which is responsible for creating the student d...

Read More

In The previous post Getting Started · Building an Application with Spring Boot  AND Building an Application with Spring Boot | PART 2 We have already learn that how to create a spring-boot application In this post we will integrate MySql database with spring-boot application. We persist the Student data in a Table named student in MySql. And our s...

Read More

With respect to scan-auto-detection and dependency injection for Bean Definition in spring all of these annotations @Component, @Service, @Repository and @Controller are same. We can use one in the place of another and still it will be registered as a bean. But the bean can loose some functionalities, that we will discuss in later part of the post....

Read More

FOLLOW US ON LinkedIn



Explore Tutu'rself