[How-to] Disable Peer Verification in Redis for Spring Boot (Lettuce & Redisson)

Disabling peer verification in Redis is sometimes necessary in development, especially when working with self-signed certificates or testing environments. This guide covers how to do it for both Lettuce (Spring Boot’s default Redis client) and Redisson—including advanced approaches available for recent Redisson versions. Why Disable Peer Verification? Peer verification ensures that your client validates the … Continue reading [How-to] Disable Peer Verification in Redis for Spring Boot (Lettuce & Redisson)

[How-To]Solve Infinite Recursion with @JsonBackReference in Spring Boot

When working with Spring Boot applications, especially those that utilize JPA (Java Persistence API) for database interactions, you may encounter a common pitfall: infinite recursion during JSON serialization. This often occurs when you have bidirectional relationships between entities. In this article, we'll explore how to effectively use the @JsonBackReference and @JsonManagedReference annotations to prevent infinite … Continue reading [How-To]Solve Infinite Recursion with @JsonBackReference in Spring Boot

[How-To] Create Self-Contained Executables: Convert Java Programs with GraalVM

Are you tired of your Java programs hitting roadblocks because others don't have Java installed? Say hello to GraalVM! This powerhouse tool converts your Java program into a self-contained executable, ensuring a seamless experience for all. With simple steps like setting environment variables and using Maven, you'll be up and running in no time.

Using Single Entity with JPA and Mongo DB in spring-boot

When dealing with data split across SQL and NoSQL, it's tricky to handle a single entity. While not ideal, use a combination of JPA and starter-data-mongo, carefully managing dependencies and creating different profiles. With careful entity and repository design, it's possible to make them work. Remember to separate repositories and handle case-sensitive fields. This approach offers an effective way to handle the situation.

[How-To]Enable Jenkinsfile Syntax Highlighting in IntelliJ

If you're working on a Java project that integrates with Jenkins, particularly using a Jenkinsfile for your pipeline, you might have encountered some frustrating issues with syntax highlighting and code completion in IntelliJ IDEA. Fear not! Here’s a step-by-step guide to setting up syntax highlighting and code completion for your Jenkinsfile, while also addressing the … Continue reading [How-To]Enable Jenkinsfile Syntax Highlighting in IntelliJ

Programmatically Retrieving Log Files in Java

In any Java application, having access to log files is crucial for debugging issues, monitoring app performance, and understanding usage patterns. In this post, we'll explore different techniques for programmatically retrieving log files in Java for administrative purposes or log analysis. Getting the Log File Location First, we need to determine where the log files … Continue reading Programmatically Retrieving Log Files in Java

How to validate keycloak token when you have multiple realms(Multi-tenancy)

Validating JWT tokens provided by Keycloak in a Spring Boot application with multiple realms can be challenging. This blog post will provide a step-by-step guide on how to implement a custom JWT decoder that can handle multiple realms. We will also discuss how to prevent session fixation using a UserInfoFilter. This blog post is intended for Spring Boot developers who are using Keycloak for authentication and authorization. It is assumed that you have a basic understanding of JWTs and Spring Security. Here is a brief overview of the topics covered in this blog post: Configuring the custom JWT decoder Integrating the custom JWT decoder into Spring Security Implementing a UserInfoFilter to prevent session fixation By following the steps in this blog post, you will be able to validate JWT tokens provided by Keycloak in a Spring Boot application with multiple realms in a secure and efficient manner.

[HOW-TO] remote debug Tomcat spring boot application in intellij ultimate/community

In this quick tutorial, I'll explain how to setup remote debugging between your local IntelliJ IDEA and a remote Tomcat server. On the Remote Server First, edit either 'catalina.bat' (Windows) or 'catalina.sh' (Linux/MacOS) on your remote Tomcat server. Find the 'JAVA_OPTS' section and add the following option: -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005 This enables remote debugging on port … Continue reading [HOW-TO] remote debug Tomcat spring boot application in intellij ultimate/community

[Java]Sending mail with Ical and freemarker template

Sending Emails with Calendar Invites in Java In this post, I will show how to send emails with calendar invites (.ics files) attached using Java and the biweekly library. 1. Define Email and Calendar Objects First, we need to define an Email class to represent the email content, and an ICalInvite class to generate the … Continue reading [Java]Sending mail with Ical and freemarker template

[How-To] [IntelliJ] Enable Hot-Reload for spring boot applications

Enable Hot Reload in IntelliJ for Spring Boot Hot reload automatically reflects code changes without having to restart your application. Here are the steps to enable hot reloading for Spring Boot projects in IntelliJ IDEA: 1. Add Spring Boot DevTools Add the following dependency in your pom.xml: <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> <scope>runtime</scope> <optional>true</optional> </dependency> 2. Enable … Continue reading [How-To] [IntelliJ] Enable Hot-Reload for spring boot applications