Posts

Convert List to Map After Java 8

Image
Hello everyone, Here we will learn how to convert List to Map in after Java 8 using Streams. What's new in this example? From Java 14 onwards, the 'record' is a special type of class declaration aimed at reducing the boilerplate code.  From Java 10 onwards, the 'var' keyword allows local variable type inference, which means the type for the local variable will be inferred by the compiler, so we don't need to declare that. Example 1: Convert List to Map after Java 14 using Streams package com.knf.dev.demo ; import java.util.ArrayList ; import java.util.List ; import java.util.Map ; import java.util.function.Function ; import java.util.stream.Collectors ; public class Main { public static void main ( String []args) { //The var keyword was introduced in Java 10. var users = new ArrayList< User >(); var user1 = new User( 1 , "user1" ); var user2 = new User( 2 , "user2" ); var user3 = new User(

Build REST CRUD APIs with Spring Boot and Spring Data JDBC

Image
Hello everyone, In this article, we will learn how to develop a  REST-style web service with Spring Boot, Spring Data JDBC, and h2 Database. GitHub repository link is provided at the end of this tutorial. You can download the source code. What's new in this example?  From Java 14 onwards, the record is a special type of class declaration aimed at reducing the boilerplate code. For more info click here From Java 10 onwards, the var keyword allows local variable type inference, which means the type for the local variable will be inferred by the compiler, so we don't need to declare that. For more info click here Technologies used :  Spring Boot 2.6.3 Spring  Data JDBC  Java 17  H2 Database Maven 3+  These are APIs that Spring backend App will export:   GET all User's        :     /api/v1/users             : get  GET User by ID     :     /api/v1/users/{id}       : get CREATE User        :     /api/v1/users             : post UPDATE User        :     /api/v1/users/{id}       

Spring Boot + PostgreSQL + Vue.js CRUD: Full stack development example

Image
Hello everyone, In this article, we will learn how to build a full-stack application that is a basic User Management Application using Spring Boot, PostgreSQL, and Vue.js.The  GitHub repository link is provided at the end of this tutorial. You can download the source code. After completing this tutorial what we will build?   We will build a full-stack web application that is a basic User Management Application with CRUD features:  • Create User • List User  • Update User • Delete User  We divided this tutorial into two parts PART 1 - Rest APIs Development using Spring Boot and PostgreSQL PART 2 - UI development using Vue.js, Axios & Bootstrap PART 1 - Rest APIs Development using Spring Boot & PostgreSQL These are APIs that Spring backend App will export:   GET all User's        :     /api/v1/users             : Get  GET User by ID      :     /api/v1/users/{id}       : Get CREATE User        :     /api/v1/users             : Post UPDATE User        :     /api/v1/users/{id}