Logging In Spring Boot

Spring Boot uses Apache Commons Logging under the hood. However, it lets you choose a logging library of your choice. Let’s take a look at Some of the configurations and best practices while using Spring Boot. Overview By default, if you use the starters, then your application will use Logback for logging. The framework also…

Changing Context Path in a Spring Boot Application

By default, Spring boot has “/” as the context path. If you wish to override/change the context path, then you can use one of the following approaches. In most scenarios, the default context path is all you would want. It gives a clean approach to writing APIs. However, there are some cases where you might…

Ways to add Servlet Filters in Spring Boot

In this post, We will take a look at ways to add servlet filters to your spring boot application. Servlet filters help a web application in many ways. They intercept requests and responses to provide different behaviors based on requests. Some of them are, Authentication and Authorization filters that help deal with security. Logging Filters…

Ways to run Code on Application Startup in Spring Boot

Let’s learn how to run a piece of code at the startup of a spring boot application. Using CommandLineRunner or ApplicationRunner interface You could provide a Bean of type CommandLineRunner or an ApplicationRunner interface. The perk of using this approach allows your code to have access to the application arguments. or Note that the only…

What is the purpose of mvnw and mvnw.cmd files?

The mvnw and mvnw.cmd files are also known as maven wrappers. These files let you run maven builds without installing a maven distribution in your machine. These files allow the users to have a fully encapsulated build system. So instead of setting up maven, PATH variables like M2_HOME, etc, the wrapper provides a self-contained build…

Apache Commons Logging – Explained

Apache Commons Logging (previously known as Jakarta Commons Logging or JCL) is a thin adapter allowing configurable bridging to other, well-known logging systems like Log4J, LogKit. But through wrappers, you can use commons-logging with any other logging systems like log4j2, SLF4J, LogBack, etc. The JCL is not a logging framework by itself. But it provides an abstraction over other…

Accessing application.properties in Spring Boot

In this post, We will take a look at accessing property values from the application.properties in a spring boot application with examples. Using @Value annotation The easiest way to access values from application.properties or application.yaml is to use the @Value annotation. Just define these annotations in your Bean classes and spring will populate the values…

A guide to @Value in Spring Boot

The @Value annotation is the quickest way to access the application.properties values in Spring Boot. It comes with some powerful features which we will explore in this tutorial. @Value Annotation in Spring Boot The @value annotation is the easiest way to inject values into primitive fields. To demo this, let’s set up an application with…

This application has no explicit mapping for /error

The “this application has no explicit mapping for /error” view is a common Spring Boot-related issue. If you are new to Spring Boot, you might have seen this error already. If you are looking for how to solve this issue, This is what you should do. What and why? You would usually see this error…

Docker setup for MySQL and phpMyAdmin

In this post, we will take a look at how to set up a MySQL database and phpMyAdmin in a local machine using docker for application development. After completing this tutorial, you will know how to run the MySQL database locally. Background Let’s face it. The hardest part of the development is setting up the…