To develop web applications, we can use the Spring MVC module that provides Model View Controller (MVC) framework for web application development. It also provides support for other features like i18n, validation, theming etc. to help the implementation of the…
Integrate Spring with Hibernate
Today we will discuss how to use Hibernate as a persistence provider with Spring when implementing data access logic with the ORM. Spring provides support to use JPA in Spring applications. If you are not familiar with Hibernate, please go…
Spring AOP
In your application you can have certain operations like transaction management, logging or security across different modules. This could create code redundancy across your application. We call these redundant operations that span across modules as cross-cutting concerns. For example, consider…
Bean scopes and life cycle
By default, all the beans provided by Spring are singletons. This essentially means, Spring will maintain a single instance of all the beans, and that single instance will be used to inject on the dependent objects. Also the same instance…
Inject values
Inject hardcoded Value To inject simple hardcoded values, we can apply the @Value annotation to the field or method/constructor parameter level of the Spring managed beans. The argument passed to the @Value annotation can only be a String. Spring will…
IoC Container – BeanFactory and ApplicationContext
One of the most important parts of the Spring framework is the Spring IoC Container. The container behaves as a factory of beans. We provide the configuration metadata to the container and the container provides us the instances of beans…
Dependency injection types
We have already discussed dependency injection in the previous article. Let’s now discuss the dependency injection types supported by Spring. Spring supports three types of dependency injection – Field Injection Setter Injection Constructor Injection Field Injection As the name indicates,…
Introduction to Spring
Spring is one of the most popular application development frameworks to build Java applications. It was developed by Rod Johnson and was first released under the Apache 2.0 license in June 2003. Spring is a lightweight open-source framework. Spring provides…
Entity versioning
In most of the enterprise application, multiple users can access the application concurrently. Suppose two users (User1 & User2) are trying to work on the same database record. Initially when they will fetch the record, it will be same for…
Caching Data
Accessing a database is an expensive operation and it takes time. When an application sends a request to the database, the request is first sent over the network. Then the request is processed by the database and finally the result…