Posts

Showing posts with the label Thymeleaf

Integration of Spring Security with Spring LDAP Authentication in Spring Boot

Image
Here’s an end-to-end example of integrating Spring Security with Spring LDAP for authentication in a Spring Boot  application. 1. Set Up Local LDAP Server To install and run an LDAP server locally, you can use Apache Directory Server or OpenLDAP . Here, I'll use Apache Directory Server (Apache DS) because it's easy to set up and works well with Spring Boot. 1.1. Install Apache Directory Server Download Apache Directory Server from the official site . Choose the latest version based on your operating system. Install Apache Directory Server : Extract the downloaded ZIP or tar.gz file to a directory of your choice. Open a terminal or command prompt and navigate to the directory where you extracted the server. Start Apache Directory Server : Run the following command to start the LDAP server: bin/apacheds .sh start For Windows, use bin/apacheds.bat start . Access the Apache Directory Studio (optional) for easier interaction with your LDAP server: Download Apache Directory Stud...

Product Management System - Spring Boot Thymeleaf PostgreSQL

Image
Here’s a step-by-step guide for building a Spring Boot CRUD application using Thymeleaf as the template engine, PostgreSQL as the database, and Bootstrap for UI styling. This includes a basic explanation of each component. Project Setup To get started, set up your Spring Boot project. Dependencies : Spring Web Spring Data JPA PostgreSQL Driver Thymeleaf Spring Boot DevTools (optional for live reload) Lombok (optional for boilerplate reduction) You can create this setup via Spring Initializr : https://start.spring.io/ Project Structure src / main /java └── com .example .demo ├── controller ├── model ├── repository ├── service └── DemoApplication .java src / main /resources └── templates └── (Thymeleaf templates) └── static └── (CSS, JS, Bootstrap) └── application .properties Steps 1. Configure PostgreSQL In application.properties : spring .datasource .url =jdbc:postgresql: //localhost:5432/your_database_name spring .datasource .username =your_username...

Spring Boot htmx Thymeleaf - CRUD Todo App

Image
In this section, we will create a Todo CRUD app with Spring Boot , htmx , Thymeleaf ,  Bootstrap , and PostgreSQL . About htmx HTMX can be used for the API/server-side calls directly in the HTML. More Info:  click here We can use HTMX to create interactive templates in our Spring Boot application. We can dynamically call and fetch data from the server by using simple HTML attributes like hx-get, hx-put, etc. We'll cover those in this article. We will be exploring the basis of HTMX by creating a basic CRUD application. Technologies Used Java 17 Spring Boot 3.3.0 Spring Data JPA PostgreSQL Thymeleaf  htmx Bootstrap Creating a spring boot application First, open the Spring initializr  https://start.spring.io Then, Provide the Group and Artifact name. We have provided Group name  com.knf.dev.demo  and Artifact  spring-boot-htmx-crud . Here I selected the Maven project - language  Java 17  -  Spring Boot 3.3.0 ,   Spring Web, Spring Data...