Posts

FireBase Crud operation in Spring Boot

Image
                       Hello Geeks, hope you are healthy and doing well in this tough time. In this particular blog post, I am going to share the simple way in which you can connect to Google's firebase real-time database. Of course, we will use some of the basic dependencies to connect our spring boot to firebase. I am going to use maven based configuration. Here, I am sharing a sample spring boot application with simple crud operation on firebase real-time DB. So, first of all, initialize our application from the  spring initializer  and extract, import the downloaded project into your favorite IDE. Dependencies I am adding here : Spring boot starter web Spring firebase admin Here is my pom.xml. <?xml version="1.0" encoding="UTF-8"?> <project xmlns= "http://maven.apache.org/POM/4.0.0" xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation= "http://m...

Swagger 2 dependency in Spring Boot

Image
Hi folks, hope i found you well in these tough time. In this particular blog i am going to implement Swagger 2 into a spring boot web application. Table of content What is swagger? Implementing  a spring boot API using swagger. Swagger has a vast set of tools for APIs development. Swagger is a tool to achieve the following Develop APIs Interact with APIs Document APIs The third one i.e. documenting APIs given swagger a lots of popularity. It is an excellent tool to document APIs. The most popular tool to do the same using something called swagger UI. In this blog we are focusing on the third one. We are going to implement a spring boot APIs and it's documentation using swagger UI. But there are some of the questions that should be answered before diving in deeper. Why we need a tools to documenting an API? The answer to above question is pretty much simpler, when some one build an API and some other user is going to consume that particular API, then consumer need to know all the en...

Logger in SpringBoot

Image
                    Hello geeks, here I came up with another interesting blog on Logger in java spring boot. To understand the logger we need their requirement first.                                In our application there are some situations, where our code breaks or behaves abnormally, to understand this we need some of the trace of code. Mean from where and why this abnormal or code break happens. So, we need to track or print out the class name, method name with line number from where the issue occurred.           So, all in all we just need a console out put mentioning the exact issue with class level and method level details with line number. We, can use a simple system.out.println but it has no any flexibility and configuration on application level, Like filtering the log level, filtering the packaging etc. The loggin...

Spring boot security basics

Image
Hello geeks, here i came up with another blog series on spring security, Where I am going to explore some of the basic concepts behind the spring boot security as well as hands on examples.  This is going to be the first blog in this series on spring boot security, so please follow all blogs in order to better understanding of the concepts.                                                 Before we begin to deep dive into spring security, we need to under stand why we need application level security. Since we have already OS level security, server level security then why we need this application level security. The answer is pretty much self explanatory, since we are developing APIs in java, these end points are explicitly exposed to end user that's why all the already applied security on OS level and server are forcefully by passed here. So, all in all we need ano...

Sending HTML template base email using spring boot.

Image
 Hello Geeks, hope you all are doing well these days. Recently i was working in my project where a case came, where I had to send an email with attachment in specific format(basically template based). So, after doing a quick research I came up with solution, In this particular blog post I am going to share the spring boot plugin i.e. free marker, to send template based multi lingual email. So, first things first. Initiate a blank spring boot application with some of dependencies listed below: 1. web dependencies spring-boot-starter-web 2. jackson dependencies jackson-dataformat-xml 3. lombok dependencies lombok 4. mail dependencies spring-boot-starter-mail 5. free marker dependencies spring-boot-starter-freemarker Here is the effective pom.xml, you can also use gradle instead of maven.  pom.xml <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-inst...

Playing With Spring Boot Banner

Image
Hello geeks, here I came up with a quick read but interesting blog post. Here I am going to show you the different possible customization available in spring boot banner.                                     Have you noticed when ever you set up a brand new spring boot application, and runs it a pretty nice spring log with version information is populated into the console, just like the screen shot below. Now, here is the stuff you can perform with this logo. You can remove the entire logo, You can customize the text of logo You can customize the font, color and style of logo. You can use any image instead of text. Let's see all of above one by one. You can remove or turn off the default spring logo populating while running spring boot application by either using properties file or by programmatically. Removing Entire Logo using application.properties file spring.main.banner-mode="off" usi...

JavaScript methods you should know about.

                      Hello folks, hope you all doing well . In this particular blog i am sharing some of tradition but evergreen javaScript methods that every one should know about. Methods forEach : This method allows you to iterate through all the elements present inside the array, pretty similar to forEach of other programming languages. example:                      array . forEach ( function ( currentValue ,  index ){                 /**             * stuff to perform with each record             */           }); map : This method returns a new array by calling the provide method once for each and every element present inside array in the order ...