In Java, you can use the Files.lines() method along with the Stream API to read a file lazily line by line. This approach is efficient for large files, as it reads and processes the file on demand rather than loading the entire file into memory. Here’s an example: import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import…
Category: Spring
List of Spring Boot Modules that are good for Start Up Micro Service
Here is a list of some potential Spring Boot Modules that are good for developing into Micro Service that you will most likely reuse across several projects. The success of start-ups is low and it is good to have the common modules (almost) ready so you could fail fast and develop the new idea fast….
Is MariaDB Good for Storing Files?
MariaDB, like most relational databases, is not primarily designed for storing files. It’s optimized for storing structured data like numbers, strings, and dates and make references between the data. Why not – Store files in the DB Do not store files in MariaDB using Blob data types, it’s not generally recommended for a couple of…
Spring Boot Minimal Code – RabbitMQ Messaging
You could use Rabbitmq as it is more user-friendly for basic Messaging and in this blog post I will give you Spring Boot Minimal Code. You will be able to archive both Synchronous and Asynchronous communication between your micro services – with very little effort. Install the Rabbit Create a new Spring Boot project using…
How to put Watermark on Image with Java Code?
To achieve putting Watermark on Image with Java Code, you can use the Java Advanced Imaging (JAI) library along with the ImageIO library or java.awt and javax.imageio. You could add Watermark without Java Advanced Imaging Library You can use the java.awt and javax.imageio packages available in the standard Java library for basic image processing. Here’s…
Spring Boot Micro Service Shutdown
One of the needs you will find when developing Spring Boot Micro Service is the ability to Shutdown applocations gracefully. You will find most of the options on the internet like here: https://www.baeldung.com/spring-boot-shutdown. I’ll add my own two cents on the topic. Why? You may find several reason to Shutdown a Micro Service. If you…
How to integrate docker into spring boot application
Dockerizing a Spring Boot application involves creating a Docker image that contains your application and its dependencies, allowing you to run the application in a containerized environment. Here’s a step-by-step guide on how to Dockerize a Spring Boot application: Step 1: Install Docker Make sure Docker is installed on your machine. You can download it…
Vaadin – Abstracting away the Web for Business Applications with Java
Vaadin is a Java framework for building modern Business Web Applications. It is designed to simplify and abstract away the complexities of web development, allowing you to create rich, interactive user interfaces using ONLY Java. I personally use it for Administrative interfaces as it minimizes the need to write separate logic for the server-side functionality…
Getting Started with Kafka + Spring Boot
Here is a getting started snippets from my personal experience with Kafka and Spring Boot. You could use them to implement the features – detailed in a previous article – that are good for separation from a big monolith. Kafka Setup Kafka is a separate service/process running on your server with its own complexities and…
How to Create a query using Spring Repository API & filter by mutliple values
In Spring Data JPA, you can use the Crud Repository or Jpa Repository interfaces to create queries for your entities to filter by multiple values of a column. You can use the IN keyword in your query method. This is an extended use case for my previous problems: https://programtom.com/dev/2023/10/24/how-to-get-child-records-count-with-spring-repository/ Let’s assume you have an entity…
