Year: 2021

In Java, you use the enumeration type to represent a list of predefined constants. But, what if you want to implement a Set interface with the enumeration type, you have got EnumSet in Java to do so. Enum constants are unique and have predefined length, as you can not define a new enum constant at […]Continue reading

There are read-only wrappers over collections which are known as unmodifiable lists. These lists do not support any modification operations such as add, remove, and clear. Hence, these kinds of lists which guarantee that no change in the Collection object will ever be visible are termed as immutablelist. The Java Collections framework provides the unmodifiableList() […]Continue reading

For a One-to-One relationship in JPA, each entity instance is related to a single instance of another entity. It means each row of one entity is referred to one and only one row of another entity. In this post,  you’ll learn how to create a One-to-One relationship between two entities using JPA in a Spring […]Continue reading

Spring Web applications and services need to process client requests sent over HTTP. When the HTTP clients send data with the request, the data is in the request body. On the application side, you need a mechanism to deserialize data sent in the request body to domain objects. This is done using the @RequestBody annotation. […]Continue reading

The Spring Ioc container is at the core of the Spring Framework. BeanFactory and ApplicationContext provide implementations of the IoC container. Both BeanFactory and ApplicationContext are interfaces and there are several implementations that come out of the box with Spring. In this post, I will explain the differences between BeanFactory and ApplicationContext. Major Differences between […]Continue reading

In Relational Database Management Systems (RDBMS), a stored procedure is a batch of prepared SQL code grouped as a logical unit that you store in the database. Stored procedures allow reusability of SQL code. In this post, I will explain how to call MySQL stored procedures from a Spring Boot application. Dependency For the application […]Continue reading

Data validation is a basic requirement for any application. This is more significant for web applications that accept data as input. Bean Validation or commonly known as JSR-380 is a Java standard that is used to perform validation in Java applications. To perform validation, data Items are applied constraints. As long as the data satisfies […]Continue reading

The Spring framework has a library called Spring State Machine which is a model of computation that depends on the finite states. It can only be in one state at a given time, hence it is also called a finite state machine. The transitions of this State Machine are the changes in the status of […]Continue reading

When you develop a Spring Bool RESTful service, you as a programmer are responsible for handling exceptions in the service. For instance, by properly handling exceptions, you can stop the disruption of the normal flow of the application. In addition, proper exception handling ensures that the code doesn’t break when an exception occurs. Another important […]Continue reading

Java 8 introduces a new date and time API defined inside the java.time package. The key date and time classes defined in this package are LocalDateTime, ZonedDateTime, and OffsetDateTime. OffsetDateTime is an immutable representation of a date-time with an offset from UTC. It stores all date and time fields, to a precision of nanoseconds. For example, you can […]Continue reading