Fading Coder

One Final Commit for the Last Sprint

Generate PDF Documents from HTML Content in Java with FreeMarker and Flying Saucer

package com.example.reporting.service; import com.itextpdf.text.pdf.BaseFont; import freemarker.cache.StringTemplateLoader; import freemarker.template.Configuration; import freemarker.template.Template; import lombok.extern.slf4j.Slf4j; import org.apache.commons.io.IOUtils; import org.springframewor...

Java Function Structure and Usage

Java functions are collections of statements that perform a specific task. They are similar to functions in other programming languages. A function is an ordered set of steps to solve a particular problem. Functions are contained within classes or objects. Functions are created in one part of the pr...

Spring Boot Fundamentals and Project Setup Guide

Web Application Development Overview Web applications are browser-accessible software systems built on client-server architecture. The development process encompasses three main areas: user interface design, frontend implementation, and backend logic processing. Frontend development focuses on creat...

Singleton Pattern Implementation in Java

The Singleton pattern belongs to the category of creational design patterns. It restricts the instantiation of a class to a single object and provides a global point of access to that instance. This approach is particularly useful when exactly one object is needed to coordinate actions across a sys...

Building a Java Tree Structure Using Recursive Algorithms and a Database

Prepare the table structrue and corresponding data a. Table srtucture: create table TB_TREE ( CID NUMBER not null, CNAME VARCHAR2(50), PID NUMBER //parent node ) b. Table data: insert into tb_tree (CID, CNAME, PID) values (1, 'China', 0); insert into tb_tree (CID, CNAME, PID) values (2, 'Beijing',...

Dynamic Table Name Replacement Using MyBatis Interceptors

Business ScenarioFor systems anticipating high data volume growth, database sharding is a common strategy to maintain performance. A typical approach involves appending suffixes to table names (e.g., converting app_user to app_user_202201) to distribute data. To implement this transparently without...

Exporting CSV Files in Java Applications

CSV (Comma-Separated Values) represents a widely adopted data format for storing tabular information in plain text files. When developing Java applications, there are scenarios where you need to generate CSV output from your application data. This guide demonstrates various approaches to create CSV...

Configuring Server-Side View Rendering with ModelAndView in Spring Boot

Enabling server-side view rendering in Spring Boot requires configuring a view resolver that maps logical names returned from controllers to physical template files. The setup involves updating project dependencies, adjusting the application entry point for external container compatibility, defining...

Dynamically Invoking Interface Methods Using Java Reflection

Reflection enables runtime examination and dynamic invocation of class members. This technique can be applied to invoke methods defined by an interface through a concrete implementation class. Core Implementation Steps The process involves several distinct stages. Step Action 1 Define the interface....

Implementing PDF File Transfer Mechanisms in Java

Java applications support multiple strategies for moving PDF binaries, ranging from standard stream operations to asynchronous network frameworks. Selection depends on whether the transfer occurs locally within the filesystem or across a network connection. Native NIO File Copying The java.nio.file...