Exception handling is an integral part of any application. It involves catching errors and showing a graceful error message to the end user. Normally, try-catch blocks are used in a java application to handle exceptions where the error raised can be shown on a console or UI. But, in a web application, (more…)
Spring provides many ways to interact with a database and perform various operations on it. One of the approach using DriverManagerDataSource was discussed in a previous post. The above approach…
What is Interceptor? An interceptor in a web application is a component which is the first to receive a request. All requests to the application first arrive at the interceptor…
Imagine you are working on a Spring application where most of the objects are created using Spring annotations and fields are also injected using Spring mechanisms (using
@Autowired or XML configuration). Now you develop a component or use an API which is written without any use of Spring and you need one of your Spring managed classes in it. (more…)
When sending data from UI to server, generally a DTO (data object) is used. But when saving to database, it must be converted to an entity which means that the values of properties from dto should be copied to the entity object.
This can be done using utility methods of BeanUtils class in Spring as:
Spring provides many ways to establish connection to a database and perform operations such as retrieval of records, insertion of new records and updating / deletion of existing records. The most basic of them is using class
org.springframework.jdbc.datasource.DriverManagerDataSource. This post will detail it out in depth.