Spring

Spring Boot Exit Codes – Create Custom Exit Code

Introduction: When running a Spring Boot application, we get a system exit code of 0, when everything goes fine.  For any unhandled exceptions, the application returns with an exit code 1. It’s possible for us to return a custom exit code from our Spring Boot application. In this tutorial, we’ll learn to do so. Implementing […]

Be the First to comment. Read More
Spring

Using @ResponseStatus for Http Status in Spring

Introduction: In Spring MVC, we can set the status of the HttpResponse in several ways. In this tutorial, we’ll achieve it using the @ResponseStatus annotation. We can use @ResponseStatus to mark a method or an exception class with a status code and reason that should be returned. On invoking the marked handler method or when […]

Be the First to comment. Read More
Spring

@Component vs @Repository vs @Service in Spring

Introduction: With Spring’s auto-scanning feature, it automatically detects various beans defined in our application. We usually annotate our beans using one of the available Spring annotations – @Component, @Repository, @Service, @Controller. On detecting the bean, Spring simply registers it into the ApplicationContext. In this quick tutorial, we’ll look at the difference between @Component, @Repository, and, […]

Be the First to comment. Read More
Spring

Spring Core Annotations

Introduction: Spring annotations present in the org.springframework.beans.factory.annotation and org.springframework.context.annotation packages are commonly known as Spring Core annotations. We can divide them into two broad categories: DI-Related Annotations & Context Configuration Annotations:     In this tutorial, we’ll explore all of these Spring Core annotations. DI-Related Annotations: 1. @Autowired: We use @Autowired to mark the dependency which […]

One comment Read More
Other Tutorials

Creating Custom Maven Archetype

Introduction: Maven archetypes are the project templates which can help us quickly create a maven starter project based on its type. It’s a great tool to bootstrap a maven project with least effort. There are wide options of archetypes available to us. Some of the popular archetypes include – maven-archetype-quickstart, maven-archetype-webapp, maven-archetype-archetype. To create a […]

2 comments Read More
Other Tutorials

Maven Dependency Scopes

Introduction: Managing dependencies is a core feature of Maven. When defining a maven dependency, the scope attribute defines the visibility of that dependency on different maven lifecycle phases such as build, test and run. The dependency scopes limit the transitivity of dependencies in any project, thereby affecting the classpath. Also, there are six different available […]

3 comments Read More
Core Java

Using Spliterator In Java

Introduction: Iterators in Java are used to traverse elements of a given source. Spliterator in Java is one among the four available Java Iterators – Iterator, Enumeration, ListIterator, and Spliterator. It is an interface available in java.util package. Spliterator was first introduced in Java 8 to support parallel programming. However, we can use it for […]

Be the First to comment. Read More
Core Java

Java TreeMap vs HashMap

Introduction: In this quick post, we’re gonna look at the similarities as well as the differences between Java HashMap and TreeMap. Similarities: Before we dive in to the differences between Java HashMap and TreeMap, let’s first look at their similarities: Both extend java.util.AbstractMap class and are part of Java Collections API Both of these Map implementations […]

Be the First to comment. Read More
Other Tutorials

Hibernate Many To Many Tutorial

Introduction: In this tutorial, we’ll learn to define and use a many-to-many entity association using Hibernate @ManyToMany annotation. Context BuildUp: To follow along with this tutorial, let’s say we have two entities – Employee and Qualification: As we know, one employee can multiple qualifications. Also, there can be N number of employees with a specific […]

One comment Read More
Other Tutorials

Identifiers In Hibernate

Introduction: Identifiers in Hibernate model the primary key attribute of an entity. It helps us to uniquely identify a JPA entity. Every entity must define an identifier. Also, it can be either simple or composite. We can define a Hibernate identifier in several ways. In this tutorial, we’ll learn how to do so. Simple (Single-Valued) […]

One comment Read More